Automated Python Download instead of Bundling
3
.gitignore
vendored
@ -21,4 +21,5 @@ Borealis-Server.exe
|
|||||||
/Update_Staging/
|
/Update_Staging/
|
||||||
|
|
||||||
# On-the-Fly Downloaded Dependencies
|
# On-the-Fly Downloaded Dependencies
|
||||||
/Dependencies/NodeJS/
|
/Dependencies/NodeJS/
|
||||||
|
/Dependencies/Python/
|
50
Borealis.ps1
@ -101,6 +101,56 @@ Run-Step "Dependencies: Download NodeJS and Bundle into Borealis" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ---------------------- Ensure Python is Present (via Installer Extraction) ----------------------
|
||||||
|
Run-Step "Dependencies: Download Python and Bundle into Borealis" {
|
||||||
|
$pythonInstallDir = Join-Path $scriptDir "Dependencies\Python"
|
||||||
|
$pythonExe = Join-Path $pythonInstallDir "python.exe"
|
||||||
|
|
||||||
|
$pythonMsiBaseUrl = "https://www.python.org/ftp/python/3.13.3/amd64/"
|
||||||
|
$pythonMsiFiles = @(
|
||||||
|
"core.msi",
|
||||||
|
"exe.msi",
|
||||||
|
"lib.msi",
|
||||||
|
"pip.msi",
|
||||||
|
"dev.msi"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (Test-Path $pythonExe)) {
|
||||||
|
if (-not (Test-Path $pythonInstallDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $pythonInstallDir | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($file in $pythonMsiFiles) {
|
||||||
|
$url = "$pythonMsiBaseUrl$file"
|
||||||
|
$localPath = Join-Path $scriptDir "Dependencies\$file"
|
||||||
|
|
||||||
|
# Download if missing
|
||||||
|
if (-not (Test-Path $localPath)) {
|
||||||
|
Invoke-WebRequest -Uri $url -OutFile $localPath
|
||||||
|
}
|
||||||
|
|
||||||
|
# Extract MSI into install directory
|
||||||
|
Start-Process -Wait -NoNewWindow -FilePath "msiexec.exe" `
|
||||||
|
-ArgumentList "/a `"$localPath`" /qn TARGETDIR=`"$pythonInstallDir`""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clean up downloaded MSIs
|
||||||
|
foreach ($file in $pythonMsiFiles) {
|
||||||
|
$localPath = Join-Path $scriptDir "Dependencies\$file"
|
||||||
|
Remove-Item $localPath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
# Validate success
|
||||||
|
if (-not (Test-Path $pythonExe)) {
|
||||||
|
throw "Python executable not found after MSI extraction."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Python successfully bundled to: $pythonExe"
|
||||||
|
} else {
|
||||||
|
Write-Host "Python already present at $pythonExe"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# ---------------------- Common Initialization & Visuals ----------------------
|
# ---------------------- Common Initialization & Visuals ----------------------
|
||||||
Clear-Host
|
Clear-Host
|
||||||
|
|
||||||
|
BIN
Dependencies/Python/DLLs/_asyncio.pyd
vendored
BIN
Dependencies/Python/DLLs/_bz2.pyd
vendored
BIN
Dependencies/Python/DLLs/_ctypes.pyd
vendored
BIN
Dependencies/Python/DLLs/_ctypes_test.pyd
vendored
BIN
Dependencies/Python/DLLs/_decimal.pyd
vendored
BIN
Dependencies/Python/DLLs/_elementtree.pyd
vendored
BIN
Dependencies/Python/DLLs/_hashlib.pyd
vendored
BIN
Dependencies/Python/DLLs/_lzma.pyd
vendored
BIN
Dependencies/Python/DLLs/_multiprocessing.pyd
vendored
BIN
Dependencies/Python/DLLs/_overlapped.pyd
vendored
BIN
Dependencies/Python/DLLs/_queue.pyd
vendored
BIN
Dependencies/Python/DLLs/_socket.pyd
vendored
BIN
Dependencies/Python/DLLs/_sqlite3.pyd
vendored
BIN
Dependencies/Python/DLLs/_ssl.pyd
vendored
BIN
Dependencies/Python/DLLs/_testbuffer.pyd
vendored
BIN
Dependencies/Python/DLLs/_testcapi.pyd
vendored
BIN
Dependencies/Python/DLLs/_testclinic.pyd
vendored
BIN
Dependencies/Python/DLLs/_testclinic_limited.pyd
vendored
BIN
Dependencies/Python/DLLs/_testconsole.pyd
vendored
BIN
Dependencies/Python/DLLs/_testimportmultiple.pyd
vendored
BIN
Dependencies/Python/DLLs/_testinternalcapi.pyd
vendored
BIN
Dependencies/Python/DLLs/_testlimitedcapi.pyd
vendored
BIN
Dependencies/Python/DLLs/_testmultiphase.pyd
vendored
BIN
Dependencies/Python/DLLs/_testsinglephase.pyd
vendored
BIN
Dependencies/Python/DLLs/_tkinter.pyd
vendored
BIN
Dependencies/Python/DLLs/_uuid.pyd
vendored
BIN
Dependencies/Python/DLLs/_wmi.pyd
vendored
BIN
Dependencies/Python/DLLs/_zoneinfo.pyd
vendored
BIN
Dependencies/Python/DLLs/libcrypto-3.dll
vendored
BIN
Dependencies/Python/DLLs/libffi-8.dll
vendored
BIN
Dependencies/Python/DLLs/libssl-3.dll
vendored
BIN
Dependencies/Python/DLLs/py.ico
vendored
Before Width: | Height: | Size: 74 KiB |
BIN
Dependencies/Python/DLLs/pyc.ico
vendored
Before Width: | Height: | Size: 77 KiB |
BIN
Dependencies/Python/DLLs/pyd.ico
vendored
Before Width: | Height: | Size: 81 KiB |
BIN
Dependencies/Python/DLLs/pyexpat.pyd
vendored
BIN
Dependencies/Python/DLLs/python_lib.cat
vendored
BIN
Dependencies/Python/DLLs/select.pyd
vendored
BIN
Dependencies/Python/DLLs/sqlite3.dll
vendored
BIN
Dependencies/Python/DLLs/tcl86t.dll
vendored
BIN
Dependencies/Python/DLLs/tk86t.dll
vendored
BIN
Dependencies/Python/DLLs/unicodedata.pyd
vendored
BIN
Dependencies/Python/DLLs/winsound.pyd
vendored
BIN
Dependencies/Python/DLLs/zlib1.dll
vendored
4
Dependencies/Python/Doc/html/.buildinfo
vendored
@ -1,4 +0,0 @@
|
|||||||
# Sphinx build info version 1
|
|
||||||
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
|
|
||||||
config: 2678e87cfa1408a5eb1f4e906732091e
|
|
||||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
|
240
Dependencies/Python/Doc/html/404.html
vendored
@ -1,240 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Page not found — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/en/latest/_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="/en/latest/_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="/en/latest/_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="/en/latest/_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="/en/latest/_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="/en/latest/_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="/en/latest/_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="/en/latest/_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="/en/latest/about.html" />
|
|
||||||
<link rel="index" title="Index" href="/en/latest/genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="/en/latest/search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="/en/latest/copyright.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/404.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="/en/latest/_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="/en/latest/_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="/en/latest/_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="/en/latest/_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="/en/latest/_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="/en/latest/_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="/en/latest/_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="/en/latest/_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="/en/latest/search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="/en/latest/genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="/en/latest/py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="/en/latest/_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="/en/latest/index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Page not found</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="/en/latest/search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<h1>Page not found</h1>
|
|
||||||
|
|
||||||
Unfortunately we couldn't find the content you were looking for.
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="/en/latest/genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="/en/latest/py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="/en/latest/_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="/en/latest/index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Page not found</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="/en/latest/search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="/en/latest/copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,175 +0,0 @@
|
|||||||
from datetime import tzinfo, timedelta, datetime
|
|
||||||
|
|
||||||
ZERO = timedelta(0)
|
|
||||||
HOUR = timedelta(hours=1)
|
|
||||||
SECOND = timedelta(seconds=1)
|
|
||||||
|
|
||||||
# A class capturing the platform's idea of local time.
|
|
||||||
# (May result in wrong values on historical times in
|
|
||||||
# timezones where UTC offset and/or the DST rules had
|
|
||||||
# changed in the past.)
|
|
||||||
import time as _time
|
|
||||||
|
|
||||||
STDOFFSET = timedelta(seconds = -_time.timezone)
|
|
||||||
if _time.daylight:
|
|
||||||
DSTOFFSET = timedelta(seconds = -_time.altzone)
|
|
||||||
else:
|
|
||||||
DSTOFFSET = STDOFFSET
|
|
||||||
|
|
||||||
DSTDIFF = DSTOFFSET - STDOFFSET
|
|
||||||
|
|
||||||
class LocalTimezone(tzinfo):
|
|
||||||
|
|
||||||
def fromutc(self, dt):
|
|
||||||
assert dt.tzinfo is self
|
|
||||||
stamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND
|
|
||||||
args = _time.localtime(stamp)[:6]
|
|
||||||
dst_diff = DSTDIFF // SECOND
|
|
||||||
# Detect fold
|
|
||||||
fold = (args == _time.localtime(stamp - dst_diff))
|
|
||||||
return datetime(*args, microsecond=dt.microsecond,
|
|
||||||
tzinfo=self, fold=fold)
|
|
||||||
|
|
||||||
def utcoffset(self, dt):
|
|
||||||
if self._isdst(dt):
|
|
||||||
return DSTOFFSET
|
|
||||||
else:
|
|
||||||
return STDOFFSET
|
|
||||||
|
|
||||||
def dst(self, dt):
|
|
||||||
if self._isdst(dt):
|
|
||||||
return DSTDIFF
|
|
||||||
else:
|
|
||||||
return ZERO
|
|
||||||
|
|
||||||
def tzname(self, dt):
|
|
||||||
return _time.tzname[self._isdst(dt)]
|
|
||||||
|
|
||||||
def _isdst(self, dt):
|
|
||||||
tt = (dt.year, dt.month, dt.day,
|
|
||||||
dt.hour, dt.minute, dt.second,
|
|
||||||
dt.weekday(), 0, 0)
|
|
||||||
stamp = _time.mktime(tt)
|
|
||||||
tt = _time.localtime(stamp)
|
|
||||||
return tt.tm_isdst > 0
|
|
||||||
|
|
||||||
Local = LocalTimezone()
|
|
||||||
|
|
||||||
|
|
||||||
# A complete implementation of current DST rules for major US time zones.
|
|
||||||
|
|
||||||
def first_sunday_on_or_after(dt):
|
|
||||||
days_to_go = 6 - dt.weekday()
|
|
||||||
if days_to_go:
|
|
||||||
dt += timedelta(days_to_go)
|
|
||||||
return dt
|
|
||||||
|
|
||||||
|
|
||||||
# US DST Rules
|
|
||||||
#
|
|
||||||
# This is a simplified (i.e., wrong for a few cases) set of rules for US
|
|
||||||
# DST start and end times. For a complete and up-to-date set of DST rules
|
|
||||||
# and timezone definitions, visit the Olson Database (or try pytz):
|
|
||||||
# http://www.twinsun.com/tz/tz-link.htm
|
|
||||||
# https://sourceforge.net/projects/pytz/ (might not be up-to-date)
|
|
||||||
#
|
|
||||||
# In the US, since 2007, DST starts at 2am (standard time) on the second
|
|
||||||
# Sunday in March, which is the first Sunday on or after Mar 8.
|
|
||||||
DSTSTART_2007 = datetime(1, 3, 8, 2)
|
|
||||||
# and ends at 2am (DST time) on the first Sunday of Nov.
|
|
||||||
DSTEND_2007 = datetime(1, 11, 1, 2)
|
|
||||||
# From 1987 to 2006, DST used to start at 2am (standard time) on the first
|
|
||||||
# Sunday in April and to end at 2am (DST time) on the last
|
|
||||||
# Sunday of October, which is the first Sunday on or after Oct 25.
|
|
||||||
DSTSTART_1987_2006 = datetime(1, 4, 1, 2)
|
|
||||||
DSTEND_1987_2006 = datetime(1, 10, 25, 2)
|
|
||||||
# From 1967 to 1986, DST used to start at 2am (standard time) on the last
|
|
||||||
# Sunday in April (the one on or after April 24) and to end at 2am (DST time)
|
|
||||||
# on the last Sunday of October, which is the first Sunday
|
|
||||||
# on or after Oct 25.
|
|
||||||
DSTSTART_1967_1986 = datetime(1, 4, 24, 2)
|
|
||||||
DSTEND_1967_1986 = DSTEND_1987_2006
|
|
||||||
|
|
||||||
def us_dst_range(year):
|
|
||||||
# Find start and end times for US DST. For years before 1967, return
|
|
||||||
# start = end for no DST.
|
|
||||||
if 2006 < year:
|
|
||||||
dststart, dstend = DSTSTART_2007, DSTEND_2007
|
|
||||||
elif 1986 < year < 2007:
|
|
||||||
dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006
|
|
||||||
elif 1966 < year < 1987:
|
|
||||||
dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986
|
|
||||||
else:
|
|
||||||
return (datetime(year, 1, 1), ) * 2
|
|
||||||
|
|
||||||
start = first_sunday_on_or_after(dststart.replace(year=year))
|
|
||||||
end = first_sunday_on_or_after(dstend.replace(year=year))
|
|
||||||
return start, end
|
|
||||||
|
|
||||||
|
|
||||||
class USTimeZone(tzinfo):
|
|
||||||
|
|
||||||
def __init__(self, hours, reprname, stdname, dstname):
|
|
||||||
self.stdoffset = timedelta(hours=hours)
|
|
||||||
self.reprname = reprname
|
|
||||||
self.stdname = stdname
|
|
||||||
self.dstname = dstname
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return self.reprname
|
|
||||||
|
|
||||||
def tzname(self, dt):
|
|
||||||
if self.dst(dt):
|
|
||||||
return self.dstname
|
|
||||||
else:
|
|
||||||
return self.stdname
|
|
||||||
|
|
||||||
def utcoffset(self, dt):
|
|
||||||
return self.stdoffset + self.dst(dt)
|
|
||||||
|
|
||||||
def dst(self, dt):
|
|
||||||
if dt is None or dt.tzinfo is None:
|
|
||||||
# An exception may be sensible here, in one or both cases.
|
|
||||||
# It depends on how you want to treat them. The default
|
|
||||||
# fromutc() implementation (called by the default astimezone()
|
|
||||||
# implementation) passes a datetime with dt.tzinfo is self.
|
|
||||||
return ZERO
|
|
||||||
assert dt.tzinfo is self
|
|
||||||
start, end = us_dst_range(dt.year)
|
|
||||||
# Can't compare naive to aware objects, so strip the timezone from
|
|
||||||
# dt first.
|
|
||||||
dt = dt.replace(tzinfo=None)
|
|
||||||
if start + HOUR <= dt < end - HOUR:
|
|
||||||
# DST is in effect.
|
|
||||||
return HOUR
|
|
||||||
if end - HOUR <= dt < end:
|
|
||||||
# Fold (an ambiguous hour): use dt.fold to disambiguate.
|
|
||||||
return ZERO if dt.fold else HOUR
|
|
||||||
if start <= dt < start + HOUR:
|
|
||||||
# Gap (a non-existent hour): reverse the fold rule.
|
|
||||||
return HOUR if dt.fold else ZERO
|
|
||||||
# DST is off.
|
|
||||||
return ZERO
|
|
||||||
|
|
||||||
def fromutc(self, dt):
|
|
||||||
assert dt.tzinfo is self
|
|
||||||
start, end = us_dst_range(dt.year)
|
|
||||||
start = start.replace(tzinfo=self)
|
|
||||||
end = end.replace(tzinfo=self)
|
|
||||||
std_time = dt + self.stdoffset
|
|
||||||
dst_time = std_time + HOUR
|
|
||||||
if end <= dst_time < end + HOUR:
|
|
||||||
# Repeated hour
|
|
||||||
return std_time.replace(fold=1)
|
|
||||||
if std_time < start or dst_time >= end:
|
|
||||||
# Standard time
|
|
||||||
return std_time
|
|
||||||
if start <= std_time < end - HOUR:
|
|
||||||
# Daylight saving time
|
|
||||||
return dst_time
|
|
||||||
|
|
||||||
|
|
||||||
Eastern = USTimeZone(-5, "Eastern", "EST", "EDT")
|
|
||||||
Central = USTimeZone(-6, "Central", "CST", "CDT")
|
|
||||||
Mountain = USTimeZone(-7, "Mountain", "MST", "MDT")
|
|
||||||
Pacific = USTimeZone(-8, "Pacific", "PST", "PDT")
|
|
Before Width: | Height: | Size: 11 KiB |
BIN
Dependencies/Python/Doc/html/_images/kde_example.png
vendored
Before Width: | Height: | Size: 308 KiB |
Before Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 170 KiB |
Before Width: | Height: | Size: 188 KiB |
Before Width: | Height: | Size: 6.3 KiB |
BIN
Dependencies/Python/Doc/html/_images/tk_msg.png
vendored
Before Width: | Height: | Size: 15 KiB |
BIN
Dependencies/Python/Doc/html/_images/turtle-star.png
vendored
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 231 KiB |
Before Width: | Height: | Size: 82 KiB |
906
Dependencies/Python/Doc/html/_static/basic.css
vendored
@ -1,906 +0,0 @@
|
|||||||
/*
|
|
||||||
* Sphinx stylesheet -- basic theme.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -- main layout ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.clearer {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.section::after {
|
|
||||||
display: block;
|
|
||||||
content: '';
|
|
||||||
clear: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- relbar ---------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.related {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related h3 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 0 0 10px;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related li.right {
|
|
||||||
float: right;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- sidebar --------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.sphinxsidebarwrapper {
|
|
||||||
padding: 10px 5px 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar {
|
|
||||||
float: left;
|
|
||||||
width: 230px;
|
|
||||||
margin-left: -100%;
|
|
||||||
font-size: 90%;
|
|
||||||
word-wrap: break-word;
|
|
||||||
overflow-wrap : break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul ul,
|
|
||||||
div.sphinxsidebar ul.want-points {
|
|
||||||
margin-left: 20px;
|
|
||||||
list-style: square;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul ul {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar form {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar input {
|
|
||||||
border: 1px solid #98dbcc;
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar #searchbox form.search {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar #searchbox input[type="text"] {
|
|
||||||
float: left;
|
|
||||||
width: 80%;
|
|
||||||
padding: 0.25em;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar #searchbox input[type="submit"] {
|
|
||||||
float: left;
|
|
||||||
width: 20%;
|
|
||||||
border-left: none;
|
|
||||||
padding: 0.25em;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
img {
|
|
||||||
border: 0;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- search page ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
ul.search {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.search li {
|
|
||||||
padding: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.search li a {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.search li p.context {
|
|
||||||
color: #888;
|
|
||||||
margin: 2px 0 0 30px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.keywordmatches li.goodmatch a {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- index page ------------------------------------------------------------ */
|
|
||||||
|
|
||||||
table.contentstable {
|
|
||||||
width: 90%;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.contentstable p.biglink {
|
|
||||||
line-height: 150%;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.biglink {
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.linkdescr {
|
|
||||||
font-style: italic;
|
|
||||||
padding-top: 5px;
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- general index --------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.indextable {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable td {
|
|
||||||
text-align: left;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable ul {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable > tbody > tr > td > ul {
|
|
||||||
padding-left: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable tr.pcap {
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.indextable tr.cap {
|
|
||||||
margin-top: 10px;
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.toggler {
|
|
||||||
margin-right: 3px;
|
|
||||||
margin-top: 3px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.modindex-jumpbox {
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
margin: 1em 0 1em 0;
|
|
||||||
padding: 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.genindex-jumpbox {
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
margin: 1em 0 1em 0;
|
|
||||||
padding: 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- domain module index --------------------------------------------------- */
|
|
||||||
|
|
||||||
table.modindextable td {
|
|
||||||
padding: 2px;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- general body styles --------------------------------------------------- */
|
|
||||||
|
|
||||||
div.body {
|
|
||||||
min-width: 360px;
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p, div.body dd, div.body li, div.body blockquote {
|
|
||||||
-moz-hyphens: auto;
|
|
||||||
-ms-hyphens: auto;
|
|
||||||
-webkit-hyphens: auto;
|
|
||||||
hyphens: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.headerlink {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: #551A8B;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1:hover > a.headerlink,
|
|
||||||
h2:hover > a.headerlink,
|
|
||||||
h3:hover > a.headerlink,
|
|
||||||
h4:hover > a.headerlink,
|
|
||||||
h5:hover > a.headerlink,
|
|
||||||
h6:hover > a.headerlink,
|
|
||||||
dt:hover > a.headerlink,
|
|
||||||
caption:hover > a.headerlink,
|
|
||||||
p.caption:hover > a.headerlink,
|
|
||||||
div.code-block-caption:hover > a.headerlink {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p.caption {
|
|
||||||
text-align: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body td {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.first {
|
|
||||||
margin-top: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.rubric {
|
|
||||||
margin-top: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-left, figure.align-left, .figure.align-left, object.align-left {
|
|
||||||
clear: left;
|
|
||||||
float: left;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-right, figure.align-right, .figure.align-right, object.align-right {
|
|
||||||
clear: right;
|
|
||||||
float: right;
|
|
||||||
margin-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-center, figure.align-center, .figure.align-center, object.align-center {
|
|
||||||
display: block;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.align-default, figure.align-default, .figure.align-default {
|
|
||||||
display: block;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-left {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-default {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- sidebars -------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.sidebar,
|
|
||||||
aside.sidebar {
|
|
||||||
margin: 0 0 0.5em 1em;
|
|
||||||
border: 1px solid #ddb;
|
|
||||||
padding: 7px;
|
|
||||||
background-color: #ffe;
|
|
||||||
width: 40%;
|
|
||||||
float: right;
|
|
||||||
clear: right;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.sidebar-title {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav.contents,
|
|
||||||
aside.topic,
|
|
||||||
div.admonition, div.topic, blockquote {
|
|
||||||
clear: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- topics ---------------------------------------------------------------- */
|
|
||||||
|
|
||||||
nav.contents,
|
|
||||||
aside.topic,
|
|
||||||
div.topic {
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 7px;
|
|
||||||
margin: 10px 0 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.topic-title {
|
|
||||||
font-size: 1.1em;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- admonitions ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.admonition {
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
padding: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.admonition dt {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.admonition-title {
|
|
||||||
margin: 0px 10px 5px 0px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p.centered {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- content of sidebars/topics/admonitions -------------------------------- */
|
|
||||||
|
|
||||||
div.sidebar > :last-child,
|
|
||||||
aside.sidebar > :last-child,
|
|
||||||
nav.contents > :last-child,
|
|
||||||
aside.topic > :last-child,
|
|
||||||
div.topic > :last-child,
|
|
||||||
div.admonition > :last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sidebar::after,
|
|
||||||
aside.sidebar::after,
|
|
||||||
nav.contents::after,
|
|
||||||
aside.topic::after,
|
|
||||||
div.topic::after,
|
|
||||||
div.admonition::after,
|
|
||||||
blockquote::after {
|
|
||||||
display: block;
|
|
||||||
content: '';
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- tables ---------------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.docutils {
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
border: 0;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.align-center {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.align-default {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table caption span.caption-number {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
table caption span.caption-text {
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils td, table.docutils th {
|
|
||||||
padding: 1px 8px 1px 5px;
|
|
||||||
border-top: 0;
|
|
||||||
border-left: 0;
|
|
||||||
border-right: 0;
|
|
||||||
border-bottom: 1px solid #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
text-align: left;
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.citation {
|
|
||||||
border-left: solid 1px gray;
|
|
||||||
margin-left: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.citation td {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
th > :first-child,
|
|
||||||
td > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
th > :last-child,
|
|
||||||
td > :last-child {
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- figures --------------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.figure, figure {
|
|
||||||
margin: 0.5em;
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.figure p.caption, figcaption {
|
|
||||||
padding: 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.figure p.caption span.caption-number,
|
|
||||||
figcaption span.caption-number {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.figure p.caption span.caption-text,
|
|
||||||
figcaption span.caption-text {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- field list styles ----------------------------------------------------- */
|
|
||||||
|
|
||||||
table.field-list td, table.field-list th {
|
|
||||||
border: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list ul {
|
|
||||||
margin: 0;
|
|
||||||
padding-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-name {
|
|
||||||
-moz-hyphens: manual;
|
|
||||||
-ms-hyphens: manual;
|
|
||||||
-webkit-hyphens: manual;
|
|
||||||
hyphens: manual;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- hlist styles ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.hlist {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.hlist td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- object description styles --------------------------------------------- */
|
|
||||||
|
|
||||||
.sig {
|
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-name, code.descname {
|
|
||||||
background-color: transparent;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-name {
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.descname {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-prename, code.descclassname {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.optional {
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-paren {
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-param.n {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* C++ specific styling */
|
|
||||||
|
|
||||||
.sig-inline.c-texpr,
|
|
||||||
.sig-inline.cpp-texpr {
|
|
||||||
font-family: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .k, .sig.c .kt,
|
|
||||||
.sig.cpp .k, .sig.cpp .kt {
|
|
||||||
color: #0033B3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .m,
|
|
||||||
.sig.cpp .m {
|
|
||||||
color: #1750EB;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .s, .sig.c .sc,
|
|
||||||
.sig.cpp .s, .sig.cpp .sc {
|
|
||||||
color: #067D17;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -- other body styles ----------------------------------------------------- */
|
|
||||||
|
|
||||||
ol.arabic {
|
|
||||||
list-style: decimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.loweralpha {
|
|
||||||
list-style: lower-alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.upperalpha {
|
|
||||||
list-style: upper-alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.lowerroman {
|
|
||||||
list-style: lower-roman;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.upperroman {
|
|
||||||
list-style: upper-roman;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(li) > ol > li:first-child > :first-child,
|
|
||||||
:not(li) > ul > li:first-child > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(li) > ol > li:last-child > :last-child,
|
|
||||||
:not(li) > ul > li:last-child > :last-child {
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple ol p,
|
|
||||||
ol.simple ul p,
|
|
||||||
ul.simple ol p,
|
|
||||||
ul.simple ul p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple > li:not(:first-child) > p,
|
|
||||||
ul.simple > li:not(:first-child) > p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple p,
|
|
||||||
ul.simple p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside.footnote > span,
|
|
||||||
div.citation > span {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
aside.footnote > span:last-of-type,
|
|
||||||
div.citation > span:last-of-type {
|
|
||||||
padding-right: 0.5em;
|
|
||||||
}
|
|
||||||
aside.footnote > p {
|
|
||||||
margin-left: 2em;
|
|
||||||
}
|
|
||||||
div.citation > p {
|
|
||||||
margin-left: 4em;
|
|
||||||
}
|
|
||||||
aside.footnote > p:last-of-type,
|
|
||||||
div.citation > p:last-of-type {
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
aside.footnote > p:last-of-type:after,
|
|
||||||
div.citation > p:last-of-type:after {
|
|
||||||
content: "";
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: fit-content(30%) auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list > dt {
|
|
||||||
font-weight: bold;
|
|
||||||
word-break: break-word;
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list > dd {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
margin-top: 0em;
|
|
||||||
margin-left: 0em;
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd ul, dd table {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd {
|
|
||||||
margin-top: 3px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig dd {
|
|
||||||
margin-top: 0px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig dl {
|
|
||||||
margin-top: 0px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl > dd:last-child,
|
|
||||||
dl > dd:last-child > :last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dt:target, span.highlighted {
|
|
||||||
background-color: #fbe54e;
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.highlighted {
|
|
||||||
fill: #fbe54e;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.glossary dt {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.versionmodified {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.system-message {
|
|
||||||
background-color: #fda;
|
|
||||||
padding: 5px;
|
|
||||||
border: 3px solid red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footnote:target {
|
|
||||||
background-color: #ffa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line-block {
|
|
||||||
display: block;
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line-block .line-block {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
margin-left: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.guilabel, .menuselection {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.accelerator {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classifier {
|
|
||||||
font-style: oblique;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classifier:before {
|
|
||||||
font-style: normal;
|
|
||||||
margin: 0 0.5em;
|
|
||||||
content: ":";
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
abbr, acronym {
|
|
||||||
border-bottom: dotted 1px;
|
|
||||||
cursor: help;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- code displays --------------------------------------------------------- */
|
|
||||||
|
|
||||||
pre {
|
|
||||||
overflow: auto;
|
|
||||||
overflow-y: hidden; /* fixes display issues on Chrome browsers */
|
|
||||||
}
|
|
||||||
|
|
||||||
pre, div[class*="highlight-"] {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.pre {
|
|
||||||
-moz-hyphens: none;
|
|
||||||
-ms-hyphens: none;
|
|
||||||
-webkit-hyphens: none;
|
|
||||||
hyphens: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
div[class*="highlight-"] {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
td.linenos pre {
|
|
||||||
border: 0;
|
|
||||||
background-color: transparent;
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable tbody {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable tr {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td.linenos {
|
|
||||||
padding-right: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td.code {
|
|
||||||
flex: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.highlight .hll {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.highlight pre,
|
|
||||||
table.highlighttable pre {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption + div {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption {
|
|
||||||
margin-top: 1em;
|
|
||||||
padding: 2px 5px;
|
|
||||||
font-size: small;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption code {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.highlighttable td.linenos,
|
|
||||||
span.linenos,
|
|
||||||
div.highlight span.gp { /* gp: Generic.Prompt */
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: text; /* Safari fallback only */
|
|
||||||
-webkit-user-select: none; /* Chrome/Safari */
|
|
||||||
-moz-user-select: none; /* Firefox */
|
|
||||||
-ms-user-select: none; /* IE10+ */
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption span.caption-number {
|
|
||||||
padding: 0.1em 0.3em;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption span.caption-text {
|
|
||||||
}
|
|
||||||
|
|
||||||
div.literal-block-wrapper {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.xref, a code {
|
|
||||||
background-color: transparent;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.viewcode-link {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.viewcode-back {
|
|
||||||
float: right;
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.viewcode-block:target {
|
|
||||||
margin: -1px -10px;
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- math display ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
img.math {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.math p {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.eqno {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.eqno a.headerlink {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.math:hover a.headerlink {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- printout stylesheet --------------------------------------------------- */
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
div.document,
|
|
||||||
div.documentwrapper,
|
|
||||||
div.bodywrapper {
|
|
||||||
margin: 0 !important;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar,
|
|
||||||
div.related,
|
|
||||||
div.footer,
|
|
||||||
#top-link {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
// add the search form and bind the events
|
|
||||||
document
|
|
||||||
.querySelector("h1")
|
|
||||||
.insertAdjacentHTML(
|
|
||||||
"afterend",
|
|
||||||
[
|
|
||||||
"<p>Filter entries by content:",
|
|
||||||
'<input type="text" value="" id="searchbox" style="width: 50%">',
|
|
||||||
'<input type="submit" id="searchbox-submit" value="Filter"></p>',
|
|
||||||
].join("\n"),
|
|
||||||
);
|
|
||||||
|
|
||||||
function doFilter() {
|
|
||||||
let query;
|
|
||||||
try {
|
|
||||||
query = new RegExp(document.querySelector("#searchbox").value, "i");
|
|
||||||
} catch (e) {
|
|
||||||
return; // not a valid regex (yet)
|
|
||||||
}
|
|
||||||
// find headers for the versions (What's new in Python X.Y.Z?)
|
|
||||||
const h2s = document.querySelectorAll("#changelog h2");
|
|
||||||
for (const h2 of h2s) {
|
|
||||||
let sections_found = 0;
|
|
||||||
// find headers for the sections (Core, Library, etc.)
|
|
||||||
const h3s = h2.parentNode.querySelectorAll("h3");
|
|
||||||
for (const h3 of h3s) {
|
|
||||||
let entries_found = 0;
|
|
||||||
// find all the entries
|
|
||||||
const lis = h3.parentNode.querySelectorAll("li");
|
|
||||||
for (let li of lis) {
|
|
||||||
// check if the query matches the entry
|
|
||||||
if (query.test(li.textContent)) {
|
|
||||||
li.style.display = "block";
|
|
||||||
entries_found++;
|
|
||||||
} else {
|
|
||||||
li.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if there are entries, show the section, otherwise hide it
|
|
||||||
if (entries_found > 0) {
|
|
||||||
h3.parentNode.style.display = "block";
|
|
||||||
sections_found++;
|
|
||||||
} else {
|
|
||||||
h3.parentNode.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sections_found > 0) {
|
|
||||||
h2.parentNode.style.display = "block";
|
|
||||||
} else {
|
|
||||||
h2.parentNode.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.querySelector("#searchbox").addEventListener("keyup", doFilter);
|
|
||||||
document
|
|
||||||
.querySelector("#searchbox-submit")
|
|
||||||
.addEventListener("click", doFilter);
|
|
||||||
});
|
|
294
Dependencies/Python/Doc/html/_static/classic.css
vendored
@ -1,294 +0,0 @@
|
|||||||
/*
|
|
||||||
* Sphinx stylesheet -- classic theme.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@import url("basic.css");
|
|
||||||
|
|
||||||
/* -- page layout ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
html {
|
|
||||||
/* CSS hack for macOS's scrollbar (see #1125) */
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
|
|
||||||
font-size: 100%;
|
|
||||||
background-color: white;
|
|
||||||
color: #000;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.document {
|
|
||||||
display: flex;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.documentwrapper {
|
|
||||||
float: left;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.bodywrapper {
|
|
||||||
margin: 0 0 0 230px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body {
|
|
||||||
background-color: white;
|
|
||||||
color: #222222;
|
|
||||||
padding: 0 20px 30px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.footer {
|
|
||||||
color: #555555;
|
|
||||||
width: 100%;
|
|
||||||
padding: 9px 0 9px 0;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.footer a {
|
|
||||||
color: #555555;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related {
|
|
||||||
background-color: white;
|
|
||||||
line-height: 30px;
|
|
||||||
color: #666666;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related a {
|
|
||||||
color: #444444;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar {
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar h3 {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
|
|
||||||
color: #444444;
|
|
||||||
font-size: 1.4em;
|
|
||||||
font-weight: normal;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar h3 a {
|
|
||||||
color: #444444;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar h4 {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
|
|
||||||
color: #444444;
|
|
||||||
font-size: 1.3em;
|
|
||||||
font-weight: normal;
|
|
||||||
margin: 5px 0 0 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar p {
|
|
||||||
color: #444444;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar p.topless {
|
|
||||||
margin: 5px 10px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar ul {
|
|
||||||
margin: 10px;
|
|
||||||
padding: 0;
|
|
||||||
color: #444444;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar a {
|
|
||||||
color: #444444;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar input {
|
|
||||||
border: 1px solid #444444;
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* for collapsible sidebar */
|
|
||||||
#sidebarbutton {
|
|
||||||
height: 100%;
|
|
||||||
background-color: #cccccc;
|
|
||||||
margin-left: 0;
|
|
||||||
color: #FFFFFF;
|
|
||||||
border-left: 1px solid white;
|
|
||||||
font-size: 1.2em;
|
|
||||||
cursor: pointer;
|
|
||||||
padding-top: 1px;
|
|
||||||
float: right;
|
|
||||||
display: table; /* for vertically centering the <span> */
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebarbutton:hover {
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebarbutton span {
|
|
||||||
display: table-cell;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebarwrapper {
|
|
||||||
float: left;
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -- hyperlink styles ------------------------------------------------------ */
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #0090c0;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: #00608f;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -- body styles ----------------------------------------------------------- */
|
|
||||||
|
|
||||||
div.body h1,
|
|
||||||
div.body h2,
|
|
||||||
div.body h3,
|
|
||||||
div.body h4,
|
|
||||||
div.body h5,
|
|
||||||
div.body h6 {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
|
|
||||||
background-color: white;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #1a1a1a;
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
margin: 20px -20px 10px -20px;
|
|
||||||
padding: 3px 0 3px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body h1 { margin-top: 0; font-size: 200%; }
|
|
||||||
div.body h2 { font-size: 160%; }
|
|
||||||
div.body h3 { font-size: 140%; }
|
|
||||||
div.body h4 { font-size: 120%; }
|
|
||||||
div.body h5 { font-size: 110%; }
|
|
||||||
div.body h6 { font-size: 100%; }
|
|
||||||
|
|
||||||
a.headerlink {
|
|
||||||
color: #aaaaaa;
|
|
||||||
font-size: 0.8em;
|
|
||||||
padding: 0 4px 0 4px;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.headerlink:hover {
|
|
||||||
background-color: #aaaaaa;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p, div.body dd, div.body li, div.body blockquote {
|
|
||||||
text-align: justify;
|
|
||||||
line-height: 130%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.admonition p.admonition-title + p {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.admonition p {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.admonition pre {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.admonition ul, div.admonition ol {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.note {
|
|
||||||
background-color: #eee;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.seealso {
|
|
||||||
background-color: #ffc;
|
|
||||||
border: 1px solid #ff6;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav.contents,
|
|
||||||
aside.topic,
|
|
||||||
div.topic {
|
|
||||||
background-color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.warning {
|
|
||||||
background-color: #ffe4e4;
|
|
||||||
border: 1px solid #f66;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.admonition-title {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.admonition-title:after {
|
|
||||||
content: ":";
|
|
||||||
}
|
|
||||||
|
|
||||||
pre {
|
|
||||||
padding: 5px;
|
|
||||||
background-color: #eeffcc;
|
|
||||||
color: #333333;
|
|
||||||
line-height: 120%;
|
|
||||||
border: 1px solid #ac9;
|
|
||||||
border-left: none;
|
|
||||||
border-right: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
background-color: #ecf0f3;
|
|
||||||
padding: 0 1px 0 1px;
|
|
||||||
font-size: 0.95em;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, dl.field-list > dt {
|
|
||||||
background-color: #ede;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning code {
|
|
||||||
background: #efc2c2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note code {
|
|
||||||
background: #d6d6d6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.viewcode-back {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.viewcode-block:target {
|
|
||||||
background-color: #f4debf;
|
|
||||||
border-top: 1px solid #ac9;
|
|
||||||
border-bottom: 1px solid #ac9;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.code-block-caption {
|
|
||||||
color: #efefef;
|
|
||||||
background-color: #1c4e63;
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
// ``function*`` denotes a generator in JavaScript, see
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
|
|
||||||
function* getHideableCopyButtonElements(rootElement) {
|
|
||||||
// yield all elements with the "go" (Generic.Output),
|
|
||||||
// "gp" (Generic.Prompt), or "gt" (Generic.Traceback) CSS class
|
|
||||||
for (const el of rootElement.querySelectorAll('.go, .gp, .gt')) {
|
|
||||||
yield el
|
|
||||||
}
|
|
||||||
// tracebacks (.gt) contain bare text elements that need to be
|
|
||||||
// wrapped in a span to hide or show the element
|
|
||||||
for (let el of rootElement.querySelectorAll('.gt')) {
|
|
||||||
while ((el = el.nextSibling) && el.nodeType !== Node.DOCUMENT_NODE) {
|
|
||||||
// stop wrapping text nodes when we hit the next output or
|
|
||||||
// prompt element
|
|
||||||
if (el.nodeType === Node.ELEMENT_NODE && el.matches(".gp, .go")) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// if the node is a text node with content, wrap it in a
|
|
||||||
// span element so that we can control visibility
|
|
||||||
if (el.nodeType === Node.TEXT_NODE && el.textContent.trim()) {
|
|
||||||
const wrapper = document.createElement("span")
|
|
||||||
el.after(wrapper)
|
|
||||||
wrapper.appendChild(el)
|
|
||||||
el = wrapper
|
|
||||||
}
|
|
||||||
yield el
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const loadCopyButton = () => {
|
|
||||||
/* Add a [>>>] button in the top-right corner of code samples to hide
|
|
||||||
* the >>> and ... prompts and the output and thus make the code
|
|
||||||
* copyable. */
|
|
||||||
const hide_text = "Hide the prompts and output"
|
|
||||||
const show_text = "Show the prompts and output"
|
|
||||||
|
|
||||||
const button = document.createElement("span")
|
|
||||||
button.classList.add("copybutton")
|
|
||||||
button.innerText = ">>>"
|
|
||||||
button.title = hide_text
|
|
||||||
button.dataset.hidden = "false"
|
|
||||||
const buttonClick = event => {
|
|
||||||
// define the behavior of the button when it's clicked
|
|
||||||
event.preventDefault()
|
|
||||||
const buttonEl = event.currentTarget
|
|
||||||
const codeEl = buttonEl.nextElementSibling
|
|
||||||
if (buttonEl.dataset.hidden === "false") {
|
|
||||||
// hide the code output
|
|
||||||
for (const el of getHideableCopyButtonElements(codeEl)) {
|
|
||||||
el.hidden = true
|
|
||||||
}
|
|
||||||
buttonEl.title = show_text
|
|
||||||
buttonEl.dataset.hidden = "true"
|
|
||||||
} else {
|
|
||||||
// show the code output
|
|
||||||
for (const el of getHideableCopyButtonElements(codeEl)) {
|
|
||||||
el.hidden = false
|
|
||||||
}
|
|
||||||
buttonEl.title = hide_text
|
|
||||||
buttonEl.dataset.hidden = "false"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const highlightedElements = document.querySelectorAll(
|
|
||||||
".highlight-python .highlight,"
|
|
||||||
+ ".highlight-python3 .highlight,"
|
|
||||||
+ ".highlight-pycon .highlight,"
|
|
||||||
+ ".highlight-pycon3 .highlight,"
|
|
||||||
+ ".highlight-default .highlight"
|
|
||||||
)
|
|
||||||
|
|
||||||
// create and add the button to all the code blocks that contain >>>
|
|
||||||
highlightedElements.forEach(el => {
|
|
||||||
el.style.position = "relative"
|
|
||||||
|
|
||||||
// if we find a console prompt (.gp), prepend the (deeply cloned) button
|
|
||||||
const clonedButton = button.cloneNode(true)
|
|
||||||
// the onclick attribute is not cloned, set it on the new element
|
|
||||||
clonedButton.onclick = buttonClick
|
|
||||||
if (el.querySelector(".gp") !== null) {
|
|
||||||
el.prepend(clonedButton)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState !== "loading") {
|
|
||||||
loadCopyButton()
|
|
||||||
} else {
|
|
||||||
document.addEventListener("DOMContentLoaded", loadCopyButton)
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
@import url("classic.css");
|
|
149
Dependencies/Python/Doc/html/_static/doctools.js
vendored
@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* Base JavaScript utilities for all Sphinx HTML documentation.
|
|
||||||
*/
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([
|
|
||||||
"TEXTAREA",
|
|
||||||
"INPUT",
|
|
||||||
"SELECT",
|
|
||||||
"BUTTON",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const _ready = (callback) => {
|
|
||||||
if (document.readyState !== "loading") {
|
|
||||||
callback();
|
|
||||||
} else {
|
|
||||||
document.addEventListener("DOMContentLoaded", callback);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small JavaScript module for the documentation.
|
|
||||||
*/
|
|
||||||
const Documentation = {
|
|
||||||
init: () => {
|
|
||||||
Documentation.initDomainIndexTable();
|
|
||||||
Documentation.initOnKeyListeners();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* i18n support
|
|
||||||
*/
|
|
||||||
TRANSLATIONS: {},
|
|
||||||
PLURAL_EXPR: (n) => (n === 1 ? 0 : 1),
|
|
||||||
LOCALE: "unknown",
|
|
||||||
|
|
||||||
// gettext and ngettext don't access this so that the functions
|
|
||||||
// can safely bound to a different name (_ = Documentation.gettext)
|
|
||||||
gettext: (string) => {
|
|
||||||
const translated = Documentation.TRANSLATIONS[string];
|
|
||||||
switch (typeof translated) {
|
|
||||||
case "undefined":
|
|
||||||
return string; // no translation
|
|
||||||
case "string":
|
|
||||||
return translated; // translation exists
|
|
||||||
default:
|
|
||||||
return translated[0]; // (singular, plural) translation tuple exists
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
ngettext: (singular, plural, n) => {
|
|
||||||
const translated = Documentation.TRANSLATIONS[singular];
|
|
||||||
if (typeof translated !== "undefined")
|
|
||||||
return translated[Documentation.PLURAL_EXPR(n)];
|
|
||||||
return n === 1 ? singular : plural;
|
|
||||||
},
|
|
||||||
|
|
||||||
addTranslations: (catalog) => {
|
|
||||||
Object.assign(Documentation.TRANSLATIONS, catalog.messages);
|
|
||||||
Documentation.PLURAL_EXPR = new Function(
|
|
||||||
"n",
|
|
||||||
`return (${catalog.plural_expr})`
|
|
||||||
);
|
|
||||||
Documentation.LOCALE = catalog.locale;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper function to focus on search bar
|
|
||||||
*/
|
|
||||||
focusSearchBar: () => {
|
|
||||||
document.querySelectorAll("input[name=q]")[0]?.focus();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise the domain index toggle buttons
|
|
||||||
*/
|
|
||||||
initDomainIndexTable: () => {
|
|
||||||
const toggler = (el) => {
|
|
||||||
const idNumber = el.id.substr(7);
|
|
||||||
const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`);
|
|
||||||
if (el.src.substr(-9) === "minus.png") {
|
|
||||||
el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`;
|
|
||||||
toggledRows.forEach((el) => (el.style.display = "none"));
|
|
||||||
} else {
|
|
||||||
el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`;
|
|
||||||
toggledRows.forEach((el) => (el.style.display = ""));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const togglerElements = document.querySelectorAll("img.toggler");
|
|
||||||
togglerElements.forEach((el) =>
|
|
||||||
el.addEventListener("click", (event) => toggler(event.currentTarget))
|
|
||||||
);
|
|
||||||
togglerElements.forEach((el) => (el.style.display = ""));
|
|
||||||
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler);
|
|
||||||
},
|
|
||||||
|
|
||||||
initOnKeyListeners: () => {
|
|
||||||
// only install a listener if it is really needed
|
|
||||||
if (
|
|
||||||
!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
|
|
||||||
!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
document.addEventListener("keydown", (event) => {
|
|
||||||
// bail for input elements
|
|
||||||
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
|
|
||||||
// bail with special keys
|
|
||||||
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
||||||
|
|
||||||
if (!event.shiftKey) {
|
|
||||||
switch (event.key) {
|
|
||||||
case "ArrowLeft":
|
|
||||||
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
|
|
||||||
|
|
||||||
const prevLink = document.querySelector('link[rel="prev"]');
|
|
||||||
if (prevLink && prevLink.href) {
|
|
||||||
window.location.href = prevLink.href;
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "ArrowRight":
|
|
||||||
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
|
|
||||||
|
|
||||||
const nextLink = document.querySelector('link[rel="next"]');
|
|
||||||
if (nextLink && nextLink.href) {
|
|
||||||
window.location.href = nextLink.href;
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// some keyboard layouts may need Shift to get /
|
|
||||||
switch (event.key) {
|
|
||||||
case "/":
|
|
||||||
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
|
|
||||||
Documentation.focusSearchBar();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// quick alias for translations
|
|
||||||
const _ = Documentation.gettext;
|
|
||||||
|
|
||||||
_ready(Documentation.init);
|
|
@ -1,13 +0,0 @@
|
|||||||
const DOCUMENTATION_OPTIONS = {
|
|
||||||
VERSION: '3.13.3',
|
|
||||||
LANGUAGE: 'en',
|
|
||||||
COLLAPSE_INDEX: false,
|
|
||||||
BUILDER: 'html',
|
|
||||||
FILE_SUFFIX: '.html',
|
|
||||||
LINK_SUFFIX: '.html',
|
|
||||||
HAS_SOURCE: true,
|
|
||||||
SOURCELINK_SUFFIX: '.txt',
|
|
||||||
NAVIGATION_WITH_KEYS: false,
|
|
||||||
SHOW_SEARCH_SUMMARY: true,
|
|
||||||
ENABLE_SEARCH_SHORTCUTS: true,
|
|
||||||
};
|
|
BIN
Dependencies/Python/Doc/html/_static/file.png
vendored
Before Width: | Height: | Size: 286 B |
@ -1,47 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
const GLOSSARY_PAGE = "glossary.html";
|
|
||||||
|
|
||||||
const glossary_search = async () => {
|
|
||||||
const response = await fetch("_static/glossary.json");
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error("Failed to fetch glossary.json");
|
|
||||||
}
|
|
||||||
const glossary = await response.json();
|
|
||||||
|
|
||||||
const params = new URLSearchParams(document.location.search).get("q");
|
|
||||||
if (!params) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const searchParam = params.toLowerCase();
|
|
||||||
const glossaryItem = glossary[searchParam];
|
|
||||||
if (!glossaryItem) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up the title text with a link to the glossary page
|
|
||||||
const glossaryTitle = document.getElementById("glossary-title");
|
|
||||||
glossaryTitle.textContent = "Glossary: " + glossaryItem.title;
|
|
||||||
const linkTarget = searchParam.replace(/ /g, "-");
|
|
||||||
glossaryTitle.href = GLOSSARY_PAGE + "#term-" + linkTarget;
|
|
||||||
|
|
||||||
// rewrite any anchor links (to other glossary terms)
|
|
||||||
// to have a full reference to the glossary page
|
|
||||||
const glossaryBody = document.getElementById("glossary-body");
|
|
||||||
glossaryBody.innerHTML = glossaryItem.body;
|
|
||||||
const anchorLinks = glossaryBody.querySelectorAll('a[href^="#"]');
|
|
||||||
anchorLinks.forEach(function (link) {
|
|
||||||
const currentUrl = link.getAttribute("href");
|
|
||||||
link.href = GLOSSARY_PAGE + currentUrl;
|
|
||||||
});
|
|
||||||
|
|
||||||
const glossaryResult = document.getElementById("glossary-result");
|
|
||||||
glossaryResult.style.display = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
if (document.readyState !== "loading") {
|
|
||||||
glossary_search().catch(console.error);
|
|
||||||
} else {
|
|
||||||
document.addEventListener("DOMContentLoaded", glossary_search);
|
|
||||||
}
|
|
@ -1,192 +0,0 @@
|
|||||||
/*
|
|
||||||
* This script contains the language-specific data used by searchtools.js,
|
|
||||||
* namely the list of stopwords, stemmer, scorer and splitter.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
|
|
||||||
|
|
||||||
|
|
||||||
/* Non-minified version is copied as a separate JS file, if available */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Porter Stemmer
|
|
||||||
*/
|
|
||||||
var Stemmer = function() {
|
|
||||||
|
|
||||||
var step2list = {
|
|
||||||
ational: 'ate',
|
|
||||||
tional: 'tion',
|
|
||||||
enci: 'ence',
|
|
||||||
anci: 'ance',
|
|
||||||
izer: 'ize',
|
|
||||||
bli: 'ble',
|
|
||||||
alli: 'al',
|
|
||||||
entli: 'ent',
|
|
||||||
eli: 'e',
|
|
||||||
ousli: 'ous',
|
|
||||||
ization: 'ize',
|
|
||||||
ation: 'ate',
|
|
||||||
ator: 'ate',
|
|
||||||
alism: 'al',
|
|
||||||
iveness: 'ive',
|
|
||||||
fulness: 'ful',
|
|
||||||
ousness: 'ous',
|
|
||||||
aliti: 'al',
|
|
||||||
iviti: 'ive',
|
|
||||||
biliti: 'ble',
|
|
||||||
logi: 'log'
|
|
||||||
};
|
|
||||||
|
|
||||||
var step3list = {
|
|
||||||
icate: 'ic',
|
|
||||||
ative: '',
|
|
||||||
alize: 'al',
|
|
||||||
iciti: 'ic',
|
|
||||||
ical: 'ic',
|
|
||||||
ful: '',
|
|
||||||
ness: ''
|
|
||||||
};
|
|
||||||
|
|
||||||
var c = "[^aeiou]"; // consonant
|
|
||||||
var v = "[aeiouy]"; // vowel
|
|
||||||
var C = c + "[^aeiouy]*"; // consonant sequence
|
|
||||||
var V = v + "[aeiou]*"; // vowel sequence
|
|
||||||
|
|
||||||
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
|
|
||||||
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
|
|
||||||
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
|
|
||||||
var s_v = "^(" + C + ")?" + v; // vowel in stem
|
|
||||||
|
|
||||||
this.stemWord = function (w) {
|
|
||||||
var stem;
|
|
||||||
var suffix;
|
|
||||||
var firstch;
|
|
||||||
var origword = w;
|
|
||||||
|
|
||||||
if (w.length < 3)
|
|
||||||
return w;
|
|
||||||
|
|
||||||
var re;
|
|
||||||
var re2;
|
|
||||||
var re3;
|
|
||||||
var re4;
|
|
||||||
|
|
||||||
firstch = w.substr(0,1);
|
|
||||||
if (firstch == "y")
|
|
||||||
w = firstch.toUpperCase() + w.substr(1);
|
|
||||||
|
|
||||||
// Step 1a
|
|
||||||
re = /^(.+?)(ss|i)es$/;
|
|
||||||
re2 = /^(.+?)([^s])s$/;
|
|
||||||
|
|
||||||
if (re.test(w))
|
|
||||||
w = w.replace(re,"$1$2");
|
|
||||||
else if (re2.test(w))
|
|
||||||
w = w.replace(re2,"$1$2");
|
|
||||||
|
|
||||||
// Step 1b
|
|
||||||
re = /^(.+?)eed$/;
|
|
||||||
re2 = /^(.+?)(ed|ing)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
re = new RegExp(mgr0);
|
|
||||||
if (re.test(fp[1])) {
|
|
||||||
re = /.$/;
|
|
||||||
w = w.replace(re,"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (re2.test(w)) {
|
|
||||||
var fp = re2.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re2 = new RegExp(s_v);
|
|
||||||
if (re2.test(stem)) {
|
|
||||||
w = stem;
|
|
||||||
re2 = /(at|bl|iz)$/;
|
|
||||||
re3 = new RegExp("([^aeiouylsz])\\1$");
|
|
||||||
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
|
||||||
if (re2.test(w))
|
|
||||||
w = w + "e";
|
|
||||||
else if (re3.test(w)) {
|
|
||||||
re = /.$/;
|
|
||||||
w = w.replace(re,"");
|
|
||||||
}
|
|
||||||
else if (re4.test(w))
|
|
||||||
w = w + "e";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 1c
|
|
||||||
re = /^(.+?)y$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re = new RegExp(s_v);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem + "i";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 2
|
|
||||||
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
suffix = fp[2];
|
|
||||||
re = new RegExp(mgr0);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem + step2list[suffix];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 3
|
|
||||||
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
suffix = fp[2];
|
|
||||||
re = new RegExp(mgr0);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem + step3list[suffix];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 4
|
|
||||||
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
|
|
||||||
re2 = /^(.+?)(s|t)(ion)$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re = new RegExp(mgr1);
|
|
||||||
if (re.test(stem))
|
|
||||||
w = stem;
|
|
||||||
}
|
|
||||||
else if (re2.test(w)) {
|
|
||||||
var fp = re2.exec(w);
|
|
||||||
stem = fp[1] + fp[2];
|
|
||||||
re2 = new RegExp(mgr1);
|
|
||||||
if (re2.test(stem))
|
|
||||||
w = stem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 5
|
|
||||||
re = /^(.+?)e$/;
|
|
||||||
if (re.test(w)) {
|
|
||||||
var fp = re.exec(w);
|
|
||||||
stem = fp[1];
|
|
||||||
re = new RegExp(mgr1);
|
|
||||||
re2 = new RegExp(meq1);
|
|
||||||
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
|
||||||
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
|
|
||||||
w = stem;
|
|
||||||
}
|
|
||||||
re = /ll$/;
|
|
||||||
re2 = new RegExp(mgr1);
|
|
||||||
if (re.test(w) && re2.test(w)) {
|
|
||||||
re = /.$/;
|
|
||||||
w = w.replace(re,"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// and turn initial Y back to y
|
|
||||||
if (firstch == "y")
|
|
||||||
w = firstch.toLowerCase() + w.substr(1);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
57
Dependencies/Python/Doc/html/_static/menu.js
vendored
@ -1,57 +0,0 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
|
|
||||||
// Make tables responsive by wrapping them in a div and making them scrollable
|
|
||||||
const tables = document.querySelectorAll("table.docutils")
|
|
||||||
tables.forEach(function(table){
|
|
||||||
table.outerHTML = '<div class="responsive-table__container">' + table.outerHTML + "</div>"
|
|
||||||
})
|
|
||||||
|
|
||||||
const togglerInput = document.querySelector(".toggler__input")
|
|
||||||
const togglerLabel = document.querySelector(".toggler__label")
|
|
||||||
const sideMenu = document.querySelector(".menu-wrapper")
|
|
||||||
const menuItems = document.querySelectorAll(".menu")
|
|
||||||
const doc = document.querySelector(".document")
|
|
||||||
const body = document.querySelector("body")
|
|
||||||
|
|
||||||
function closeMenu() {
|
|
||||||
togglerInput.checked = false
|
|
||||||
sideMenu.setAttribute("aria-expanded", "false")
|
|
||||||
sideMenu.setAttribute("aria-hidden", "true")
|
|
||||||
togglerLabel.setAttribute("aria-pressed", "false")
|
|
||||||
body.style.overflow = "visible"
|
|
||||||
}
|
|
||||||
function openMenu() {
|
|
||||||
togglerInput.checked = true
|
|
||||||
sideMenu.setAttribute("aria-expanded", "true")
|
|
||||||
sideMenu.setAttribute("aria-hidden", "false")
|
|
||||||
togglerLabel.setAttribute("aria-pressed", "true")
|
|
||||||
body.style.overflow = "hidden"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close menu when link on the sideMenu is clicked
|
|
||||||
sideMenu.addEventListener("click", function (event) {
|
|
||||||
let target = event.target
|
|
||||||
if (target.tagName.toLowerCase() !== "a") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
closeMenu()
|
|
||||||
})
|
|
||||||
// Add accessibility data when sideMenu is opened/closed
|
|
||||||
togglerInput.addEventListener("change", function (_event) {
|
|
||||||
togglerInput.checked ? openMenu() : closeMenu()
|
|
||||||
})
|
|
||||||
// Make sideMenu links tabbable only when visible
|
|
||||||
for(let menuItem of menuItems) {
|
|
||||||
if(togglerInput.checked) {
|
|
||||||
menuItem.setAttribute("tabindex", "0")
|
|
||||||
} else {
|
|
||||||
menuItem.setAttribute("tabindex", "-1")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Close sideMenu when document body is clicked
|
|
||||||
doc.addEventListener("click", function () {
|
|
||||||
if (togglerInput.checked) {
|
|
||||||
closeMenu()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
BIN
Dependencies/Python/Doc/html/_static/minus.png
vendored
Before Width: | Height: | Size: 90 B |
BIN
Dependencies/Python/Doc/html/_static/og-image.png
vendored
Before Width: | Height: | Size: 14 KiB |
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
|
||||||
<ShortName>Python</ShortName>
|
|
||||||
<Description>Search Python 3.13.3 documentation</Description>
|
|
||||||
<InputEncoding>utf-8</InputEncoding>
|
|
||||||
<Url type="text/html" method="get"
|
|
||||||
template="https://docs.python.org/3.13/search.html?q={searchTerms}"/>
|
|
||||||
<LongName>Python 3.13.3 documentation</LongName>
|
|
||||||
<Image height="16" width="16" type="image/x-icon">https://www.python.org/images/favicon16x16.ico</Image>
|
|
||||||
</OpenSearchDescription>
|
|
BIN
Dependencies/Python/Doc/html/_static/plus.png
vendored
Before Width: | Height: | Size: 90 B |
BIN
Dependencies/Python/Doc/html/_static/py.png
vendored
Before Width: | Height: | Size: 695 B |
14
Dependencies/Python/Doc/html/_static/py.svg
vendored
@ -1,14 +0,0 @@
|
|||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M7.90472 0.00013087C7.24498 0.00316295 6.61493 0.0588153 6.06056 0.15584C4.42744 0.441207 4.13093 1.0385 4.13093 2.14002V3.59479H7.99018V4.07971H4.13093H2.68259C1.56098 4.07971 0.578874 4.7465 0.271682 6.01495C-0.0826595 7.4689 -0.0983765 8.37618 0.271682 9.89434C0.546011 11.0244 1.20115 11.8296 2.32275 11.8296H3.64965V10.0856C3.64965 8.82574 4.75178 7.71441 6.06056 7.71441H9.91531C10.9883 7.71441 11.8449 6.84056 11.8449 5.77472V2.14002C11.8449 1.10556 10.9626 0.328486 9.91531 0.15584C9.25235 0.046687 8.56447 -0.00290121 7.90472 0.00013087ZM5.81767 1.17017C6.2163 1.17017 6.54184 1.49742 6.54184 1.89978C6.54184 2.30072 6.2163 2.62494 5.81767 2.62494C5.41761 2.62494 5.0935 2.30072 5.0935 1.89978C5.0935 1.49742 5.41761 1.17017 5.81767 1.17017Z" fill="url(#paint0_linear)"/>
|
|
||||||
<path d="M12.3262 4.07971V5.77472C12.3262 7.08883 11.1998 8.19488 9.9153 8.19488H6.06055C5.00466 8.19488 4.13092 9.0887 4.13092 10.1346V13.7693C4.13092 14.8037 5.04038 15.4122 6.06055 15.709C7.28217 16.0642 8.45364 16.1285 9.9153 15.709C10.8869 15.4307 11.8449 14.8708 11.8449 13.7693V12.3145H7.99017V11.8296H11.8449H13.7746C14.8962 11.8296 15.3141 11.0558 15.7042 9.89434C16.1071 8.69865 16.09 7.5488 15.7042 6.01495C15.427 4.91058 14.8976 4.07971 13.7746 4.07971H12.3262ZM10.1582 13.2843C10.5583 13.2843 10.8824 13.6086 10.8824 14.0095C10.8824 14.4119 10.5583 14.7391 10.1582 14.7391C9.75955 14.7391 9.43402 14.4119 9.43402 14.0095C9.43402 13.6086 9.75955 13.2843 10.1582 13.2843Z" fill="url(#paint1_linear)"/>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="paint0_linear" x1="1.25961e-08" y1="1.08223e-08" x2="8.81664" y2="7.59597" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#5A9FD4"/>
|
|
||||||
<stop offset="1" stop-color="#306998"/>
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient id="paint1_linear" x1="10.0654" y1="13.8872" x2="6.91912" y2="9.42957" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#FFD43B"/>
|
|
||||||
<stop offset="1" stop-color="#FFE873"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 2.0 KiB |
766
Dependencies/Python/Doc/html/_static/pydoctheme.css
vendored
@ -1,766 +0,0 @@
|
|||||||
@import url('classic.css');
|
|
||||||
|
|
||||||
/* Common colours */
|
|
||||||
:root {
|
|
||||||
--good-color: rgb(41 100 51);
|
|
||||||
--good-border: rgb(79 196 100);
|
|
||||||
--middle-color: rgb(133 72 38);
|
|
||||||
--middle-border: rgb(244, 227, 76);
|
|
||||||
--bad-color: rgb(159 49 51);
|
|
||||||
--bad-border: rgb(244, 76, 78);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* unset some styles from the classic stylesheet */
|
|
||||||
div.document,
|
|
||||||
div.body,
|
|
||||||
div.related,
|
|
||||||
div.body h1,
|
|
||||||
div.body h2,
|
|
||||||
div.body h3,
|
|
||||||
div.body h4,
|
|
||||||
div.body h5,
|
|
||||||
div.body h6,
|
|
||||||
div.sphinxsidebar a,
|
|
||||||
div.sphinxsidebar p,
|
|
||||||
div.sphinxsidebar ul,
|
|
||||||
div.sphinxsidebar h3,
|
|
||||||
div.sphinxsidebar h3 a,
|
|
||||||
div.sphinxsidebar h4,
|
|
||||||
.menu a,
|
|
||||||
.menu p,
|
|
||||||
.menu ul,
|
|
||||||
.menu h3,
|
|
||||||
.menu h3 a,
|
|
||||||
.menu h4,
|
|
||||||
table.docutils td,
|
|
||||||
table.indextable tr.cap,
|
|
||||||
pre {
|
|
||||||
background-color: inherit;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add underlines to links */
|
|
||||||
a[href] {
|
|
||||||
text-decoration: underline 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Increase the underline offset for code to avoid obscuring underscores */
|
|
||||||
a[href]:has(> code) {
|
|
||||||
text-underline-offset: 0.25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No underline for navigation */
|
|
||||||
a.headerlink,
|
|
||||||
div.genindex-jumpbox a,
|
|
||||||
div.modindex-jumpbox a,
|
|
||||||
div#search-results a,
|
|
||||||
div.sphinxsidebar a,
|
|
||||||
div.toctree-wrapper a,
|
|
||||||
div[role=navigation] a,
|
|
||||||
table.contentstable a,
|
|
||||||
table.indextable a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Except when hovered */
|
|
||||||
div.genindex-jumpbox a:hover,
|
|
||||||
div.modindex-jumpbox a:hover,
|
|
||||||
div#search-results a:hover,
|
|
||||||
div.sphinxsidebar a:hover,
|
|
||||||
div.toctree-wrapper a:hover,
|
|
||||||
div[role=navigation] a:hover,
|
|
||||||
table.contentstable a:hover,
|
|
||||||
table.indextable a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
text-underline-offset: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin-left: 1em;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-nav,
|
|
||||||
.menu-wrapper {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related {
|
|
||||||
margin-top: 0.5em;
|
|
||||||
margin-bottom: 1.2em;
|
|
||||||
padding: 0.5em 0;
|
|
||||||
border-width: 1px;
|
|
||||||
border-color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-nav + div.related {
|
|
||||||
border-bottom-style: solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.document + div.related {
|
|
||||||
border-top-style: solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related a:hover {
|
|
||||||
color: #0095c4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.related .switchers {
|
|
||||||
display: inline-flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.switchers > div {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related ul::after {
|
|
||||||
content: '';
|
|
||||||
clear: both;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inline-search,
|
|
||||||
form.inline-search input {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
form.inline-search input[type='submit'] {
|
|
||||||
width: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.document {
|
|
||||||
display: flex;
|
|
||||||
/* Don't let long code literals extend beyond the right side of the screen */
|
|
||||||
overflow-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't let long code literals extend beyond the right side of the screen */
|
|
||||||
span.pre {
|
|
||||||
white-space: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar {
|
|
||||||
display: flex;
|
|
||||||
width: min(25vw, 350px);
|
|
||||||
float: none;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
max-height: 100vh;
|
|
||||||
color: #444;
|
|
||||||
background-color: #eee;
|
|
||||||
border-radius: 5px;
|
|
||||||
line-height: 130%;
|
|
||||||
font-size: smaller;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar h3,
|
|
||||||
div.sphinxsidebar h4 {
|
|
||||||
margin-top: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.bodywrapper {
|
|
||||||
margin-left: min(25vw, 350px);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebarwrapper {
|
|
||||||
box-sizing: border-box;
|
|
||||||
height: 100%;
|
|
||||||
overflow-x: hidden;
|
|
||||||
overflow-y: auto;
|
|
||||||
float: none;
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebarwrapper > h3:first-child {
|
|
||||||
margin-top: 0.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebarwrapper > ul > li > ul > li {
|
|
||||||
margin-bottom: 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar a:hover {
|
|
||||||
color: #0095c4;
|
|
||||||
}
|
|
||||||
|
|
||||||
form.inline-search input,
|
|
||||||
div.sphinxsidebar input,
|
|
||||||
div.related input {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
|
|
||||||
border: 1px solid #999999;
|
|
||||||
font-size: smaller;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sphinxsidebar input[type='text'] {
|
|
||||||
max-width: 150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebarbutton {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
/* Sphinx 4.x and earlier compat */
|
|
||||||
height: 100%;
|
|
||||||
background-color: #CCCCCC;
|
|
||||||
margin-left: 0;
|
|
||||||
color: #444444;
|
|
||||||
font-size: 1.2em;
|
|
||||||
cursor: pointer;
|
|
||||||
padding-top: 1px;
|
|
||||||
float: none;
|
|
||||||
/* after Sphinx 4.x and earlier is dropped, only the below is needed */
|
|
||||||
width: 12px;
|
|
||||||
min-width: 12px;
|
|
||||||
border-radius: 0 5px 5px 0;
|
|
||||||
border-left: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebarbutton:hover {
|
|
||||||
background-color: #AAAAAA;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body {
|
|
||||||
padding: 0 0 0 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body p, div.body dd, div.body li, div.body blockquote {
|
|
||||||
text-align: left;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
|
|
||||||
margin: 0;
|
|
||||||
border: 0;
|
|
||||||
padding: 0.3em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body hr {
|
|
||||||
border: 0;
|
|
||||||
background-color: #ccc;
|
|
||||||
height: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body pre {
|
|
||||||
border-radius: 3px;
|
|
||||||
border: 1px solid #ac9;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Admonitions */
|
|
||||||
:root {
|
|
||||||
--admonition-background: #eee;
|
|
||||||
--admonition-border: #ccc;
|
|
||||||
--admonition-color: black;
|
|
||||||
--attention-background: #bbddff5c;
|
|
||||||
--attention-border: #0000ff36;
|
|
||||||
--caution-background: #ffc;
|
|
||||||
--caution-border: #dd6;
|
|
||||||
--danger-background: #ffe4e4;
|
|
||||||
--danger-border: red;
|
|
||||||
--error-background: #ffe4e4;
|
|
||||||
--error-border: red;
|
|
||||||
--hint-background: #dfd;
|
|
||||||
--hint-border: green;
|
|
||||||
--seealso-background: #ffc;
|
|
||||||
--seealso-border: #dd6;
|
|
||||||
--tip-background: #dfd;
|
|
||||||
--tip-border: green;
|
|
||||||
--warning-background: #ffe4e4;
|
|
||||||
--warning-border: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition {
|
|
||||||
background-color: var(--admonition-background);
|
|
||||||
border: 1px solid var(--admonition-border);
|
|
||||||
border-radius: 3px;
|
|
||||||
color: var(--admonition-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.attention {
|
|
||||||
background-color: var(--attention-background);
|
|
||||||
border-color: var(--attention-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.caution {
|
|
||||||
background-color: var(--caution-background);
|
|
||||||
border-color: var(--caution-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.danger {
|
|
||||||
background-color: var(--danger-background);
|
|
||||||
border-color: var(--danger-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.error {
|
|
||||||
background-color: var(--error-background);
|
|
||||||
border-color: var(--error-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.hint {
|
|
||||||
background-color: var(--hint-background);
|
|
||||||
border-color: var(--hint-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.seealso {
|
|
||||||
background-color: var(--seealso-background);
|
|
||||||
border-color: var(--seealso-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.tip {
|
|
||||||
background-color: var(--tip-background);
|
|
||||||
border-color: var(--tip-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.admonition.warning {
|
|
||||||
background-color: var(--warning-background);
|
|
||||||
border-color: var(--warning-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.impl-detail {
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.impl-detail > p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body a {
|
|
||||||
color: #0072aa;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body a:visited {
|
|
||||||
color: #6363bb;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body a:hover {
|
|
||||||
color: #00b0e4;
|
|
||||||
}
|
|
||||||
|
|
||||||
tt, code, pre {
|
|
||||||
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
|
|
||||||
font-size: 96.5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body tt,
|
|
||||||
div.body code {
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body tt.descname,
|
|
||||||
div.body code.descname {
|
|
||||||
font-size: 120%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body tt.xref,
|
|
||||||
div.body a tt,
|
|
||||||
div.body code.xref,
|
|
||||||
div.body a code {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
min-width: 20%;
|
|
||||||
border-radius: 3px;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils td,
|
|
||||||
table.docutils th {
|
|
||||||
border: 1px solid #ddd !important;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 0.3em 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
table p,
|
|
||||||
table li {
|
|
||||||
text-align: left !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils th {
|
|
||||||
background-color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.footnote,
|
|
||||||
table.footnote td {
|
|
||||||
border: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.footer {
|
|
||||||
line-height: 150%;
|
|
||||||
text-align: right;
|
|
||||||
width: auto;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.footer a {
|
|
||||||
text-underline-offset: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.footer a:hover {
|
|
||||||
color: #0095c4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* C API return value annotations */
|
|
||||||
:root {
|
|
||||||
--refcount: var(--good-color);
|
|
||||||
--refcount-return-borrowed-ref: var(--middle-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.refcount {
|
|
||||||
color: var(--refcount);
|
|
||||||
}
|
|
||||||
|
|
||||||
.refcount.return_borrowed_ref {
|
|
||||||
color: var(--refcount-return-borrowed-ref)
|
|
||||||
}
|
|
||||||
|
|
||||||
.stableabi {
|
|
||||||
color: #229;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl > dt span ~ em,
|
|
||||||
.sig {
|
|
||||||
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toctree-wrapper ul {
|
|
||||||
padding-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-selector {
|
|
||||||
margin-left: .5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.genindex-jumpbox,
|
|
||||||
div.genindex-jumpbox > p {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.genindex-jumpbox a {
|
|
||||||
margin: 0 5px;
|
|
||||||
min-width: 30px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.copybutton {
|
|
||||||
cursor: pointer;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
|
|
||||||
padding-left: 0.2em;
|
|
||||||
padding-right: 0.2em;
|
|
||||||
border-radius: 0 3px 0 0;
|
|
||||||
color: #ac9; /* follows div.body pre */
|
|
||||||
border-color: #ac9; /* follows div.body pre */
|
|
||||||
border-style: solid; /* follows div.body pre */
|
|
||||||
border-width: 1px; /* follows div.body pre */
|
|
||||||
}
|
|
||||||
|
|
||||||
.copybutton[data-hidden='true'] {
|
|
||||||
text-decoration: line-through;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1023px) {
|
|
||||||
/* Body layout */
|
|
||||||
div.body {
|
|
||||||
min-width: 100%;
|
|
||||||
padding: 0;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
div.bodywrapper {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
/* Typography */
|
|
||||||
div.body h1 {
|
|
||||||
font-size: 1.625rem;
|
|
||||||
}
|
|
||||||
div.body h2 {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
||||||
div.body h3, div.body h4, div.body h5 {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
/* Override default styles to make more readable */
|
|
||||||
div.body ul {
|
|
||||||
padding-inline-start: 1rem;
|
|
||||||
}
|
|
||||||
div.body blockquote {
|
|
||||||
margin-inline-start: 1rem;
|
|
||||||
margin-inline-end: 0;
|
|
||||||
}
|
|
||||||
/* Remove sidebar and top related bar */
|
|
||||||
div.related, div.sphinxsidebar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
/* Anchorlinks are not hidden by fixed-positioned navbar when scrolled to */
|
|
||||||
html {
|
|
||||||
scroll-padding-top: 40px;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin-top: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Top navigation bar */
|
|
||||||
.mobile-nav {
|
|
||||||
display: block;
|
|
||||||
height: 40px;
|
|
||||||
width: 100%;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
box-shadow: rgba(0, 0, 0, 0.25) 0 0 2px 0;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
.mobile-nav * {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.nav-content {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
height: 40px;
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
.nav-items-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex: auto;
|
|
||||||
padding: .25rem;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
.nav-logo {
|
|
||||||
margin-right: 1rem;
|
|
||||||
flex-shrink: 0;
|
|
||||||
align-self: center;
|
|
||||||
}
|
|
||||||
.nav-content img {
|
|
||||||
display: block;
|
|
||||||
width: 20px;
|
|
||||||
}
|
|
||||||
.version_switcher_placeholder {
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
.version_switcher_placeholder > select {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.nav-content .search {
|
|
||||||
display: flex;
|
|
||||||
flex: auto;
|
|
||||||
border: 1px solid #a9a9a9;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
.nav-content .search input[type=search] {
|
|
||||||
border: 0;
|
|
||||||
padding-left: 24px;
|
|
||||||
width: 100%;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.nav-content .search input[type=submit] {
|
|
||||||
height: 100%;
|
|
||||||
box-shadow: none;
|
|
||||||
border: 0;
|
|
||||||
border-left: 1px solid #a9a9a9;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
.nav-content .search svg {
|
|
||||||
position: absolute;
|
|
||||||
align-self: center;
|
|
||||||
padding-left: 4px;
|
|
||||||
}
|
|
||||||
.toggler__input {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.toggler__label {
|
|
||||||
width: 40px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 8px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.toggler__label:hover, .toggler__label:focus {
|
|
||||||
background-color: rgba(127 127 127 / 50%);
|
|
||||||
}
|
|
||||||
.toggler__label > span {
|
|
||||||
position: relative;
|
|
||||||
flex: none;
|
|
||||||
height: 2px;
|
|
||||||
width: 100%;
|
|
||||||
background: currentColor;
|
|
||||||
transition: all 400ms ease;
|
|
||||||
}
|
|
||||||
.toggler__label > span::before,
|
|
||||||
.toggler__label > span::after {
|
|
||||||
content: '';
|
|
||||||
height: 2px;
|
|
||||||
width: 100%;
|
|
||||||
background: inherit;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: -8px;
|
|
||||||
}
|
|
||||||
.toggler__label > span::after {
|
|
||||||
top: 8px;
|
|
||||||
}
|
|
||||||
.toggler__input:checked ~ nav > .toggler__label span {
|
|
||||||
transform: rotate(135deg);
|
|
||||||
}
|
|
||||||
.toggler__input:checked ~ nav > .toggler__label span::before {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
.toggler__input:checked ~ nav > .toggler__label span::before,
|
|
||||||
.toggler__input:checked ~ nav > .toggler__label span::after {
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
.toggler__input:checked:hover ~ nav > .toggler__label span {
|
|
||||||
transform: rotate(315deg);
|
|
||||||
}
|
|
||||||
.toggler__input:checked ~ .menu-wrapper {
|
|
||||||
visibility: visible;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sliding side menu */
|
|
||||||
.menu-wrapper {
|
|
||||||
display: block;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
transition: left 400ms ease;
|
|
||||||
left: -310px;
|
|
||||||
width: 300px;
|
|
||||||
height: 100%;
|
|
||||||
background-color: #eee;
|
|
||||||
color: #444444;
|
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
.menu-wrapper.open {
|
|
||||||
visibility: visible;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.menu {
|
|
||||||
padding: 40px 10px 30px 20px;
|
|
||||||
}
|
|
||||||
.menu-wrapper h3,
|
|
||||||
.menu-wrapper h4 {
|
|
||||||
margin-bottom: 0;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
.menu-wrapper h4 {
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
.menu-wrapper h3 {
|
|
||||||
font-size: 1.4em;
|
|
||||||
}
|
|
||||||
.menu-wrapper h3 + p,
|
|
||||||
.menu-wrapper h4 + p {
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
.menu a {
|
|
||||||
font-size: smaller;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.menu ul {
|
|
||||||
list-style: none;
|
|
||||||
line-height: 1.4;
|
|
||||||
overflow-wrap: break-word;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
.menu ul ul {
|
|
||||||
margin-left: 20px;
|
|
||||||
list-style: square;
|
|
||||||
}
|
|
||||||
.menu ul li {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
.language_switcher_placeholder {
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
.language_switcher_placeholder select {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.document {
|
|
||||||
position: relative;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
/*Responsive tables*/
|
|
||||||
.responsive-table__container {
|
|
||||||
width: 100%;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu .theme-selector-label {
|
|
||||||
margin-top: .5em;
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu .theme-selector {
|
|
||||||
flex: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
div.footer {
|
|
||||||
margin-top: -2em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Version change directives */
|
|
||||||
:root {
|
|
||||||
--versionadded: var(--good-color);
|
|
||||||
--versionchanged: var(--middle-color);
|
|
||||||
--deprecated: var(--bad-color);
|
|
||||||
|
|
||||||
--versionadded-border: var(--good-border);
|
|
||||||
--versionchanged-border: var(--middle-border);
|
|
||||||
--deprecated-border: var(--bad-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.versionadded,
|
|
||||||
div.versionchanged,
|
|
||||||
div.deprecated,
|
|
||||||
div.deprecated-removed {
|
|
||||||
border-left: 3px solid;
|
|
||||||
padding: 0 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.versionadded {
|
|
||||||
border-left-color: var(--versionadded-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.versionchanged {
|
|
||||||
border-left-color: var(--versionchanged-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.deprecated,
|
|
||||||
div.deprecated-removed,
|
|
||||||
div.versionremoved {
|
|
||||||
border-left-color: var(--deprecated-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.versionadded .versionmodified {
|
|
||||||
color: var(--versionadded);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.versionchanged .versionmodified {
|
|
||||||
color: var(--versionchanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.deprecated .versionmodified,
|
|
||||||
div.deprecated-removed .versionmodified,
|
|
||||||
div.versionremoved .versionmodified {
|
|
||||||
color: var(--deprecated);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hide header when printing */
|
|
||||||
@media print {
|
|
||||||
div.mobile-nav {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,178 +0,0 @@
|
|||||||
/* Common colours */
|
|
||||||
:root {
|
|
||||||
--good-color: rgb(79 196 100);
|
|
||||||
--good-border: var(--good-color);
|
|
||||||
--middle-color: rgb(244, 227, 76);
|
|
||||||
--middle-border: var(--middle-color);
|
|
||||||
--bad-color: rgb(244, 76, 78);
|
|
||||||
--bad-border: var(--bad-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Browser elements */
|
|
||||||
:root {
|
|
||||||
scrollbar-color: #616161 transparent;
|
|
||||||
color-scheme: dark;
|
|
||||||
}
|
|
||||||
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
background-color: #222;
|
|
||||||
color: rgba(255, 255, 255, 0.87);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related {
|
|
||||||
color: rgba(255, 255, 255, 0.7); /* classic overwrite */
|
|
||||||
border-color: #424242;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SIDEBAR */
|
|
||||||
div.sphinxsidebar, .menu-wrapper {
|
|
||||||
background-color: #333;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebarbutton {
|
|
||||||
/* important to overwrite style attribute */
|
|
||||||
background-color: #555 !important;
|
|
||||||
color: inherit !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.sidebar, aside.sidebar {
|
|
||||||
background-color: #424242;
|
|
||||||
border-color: #616161;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ANCHORS AND HIGHLIGHTS */
|
|
||||||
div.body a {
|
|
||||||
color: #7af;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body a:visited {
|
|
||||||
color: #09e;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.headerlink:hover {
|
|
||||||
background-color: #424242;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.related a {
|
|
||||||
color: currentColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.footer,
|
|
||||||
div.footer a {
|
|
||||||
color: currentColor; /* classic overwrites */
|
|
||||||
}
|
|
||||||
|
|
||||||
dt:target,
|
|
||||||
span.highlighted {
|
|
||||||
background-color: #616161;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footnote:target {
|
|
||||||
background-color: #2c3e50;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Below for most things in text */
|
|
||||||
|
|
||||||
dl.field-list > dt {
|
|
||||||
background-color: #434;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils td,
|
|
||||||
table.docutils th {
|
|
||||||
border-color: #616161 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.docutils th {
|
|
||||||
background-color: #424242;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stableabi {
|
|
||||||
color: #bbf;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body pre {
|
|
||||||
border-color: #616161;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
background-color: #424242;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.body div.seealso {
|
|
||||||
background-color: rgba(255, 255, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.warning {
|
|
||||||
background-color: rgba(255, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning code {
|
|
||||||
background-color: rgba(255, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Admonitions */
|
|
||||||
:root {
|
|
||||||
--admonition-background: #ffffff1a;
|
|
||||||
--admonition-border: currentColor;
|
|
||||||
--admonition-color: #ffffffde;
|
|
||||||
--attention-background: #ffffff1a;
|
|
||||||
--attention-border: currentColor;
|
|
||||||
--caution-background: #ffff001a;
|
|
||||||
--caution-border: #dd6;
|
|
||||||
--danger-background: #f003;
|
|
||||||
--danger-border: #f66;
|
|
||||||
--error-background: #f003;
|
|
||||||
--error-border: #f66;
|
|
||||||
--hint-background: #0044117a;
|
|
||||||
--hint-border: green;
|
|
||||||
--seealso-background: #ffff001a;
|
|
||||||
--seealso-border: #dd6;
|
|
||||||
--tip-background: #0044117a;
|
|
||||||
--tip-border: green;
|
|
||||||
--warning-background: #ff000033;
|
|
||||||
--warning-border: #ff6666;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside.topic,
|
|
||||||
div.topic,
|
|
||||||
div.note,
|
|
||||||
nav.contents {
|
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
|
||||||
border-color: currentColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note code {
|
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-nav {
|
|
||||||
box-shadow: rgba(255, 255, 255, 0.25) 0 0 2px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-content {
|
|
||||||
background-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.invert-in-dark-mode {
|
|
||||||
filter: invert(1) hue-rotate(.5turn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- object description styles --------------------------------------------- */
|
|
||||||
|
|
||||||
/* C++ specific styling */
|
|
||||||
|
|
||||||
/* Override Sphinx's basic.css to fix colour contrast */
|
|
||||||
.sig.c .k, .sig.c .kt,
|
|
||||||
.sig.cpp .k, .sig.cpp .kt {
|
|
||||||
color: #5283ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Version change directives */
|
|
||||||
:root {
|
|
||||||
--versionadded: var(--good-color);
|
|
||||||
--versionchanged: var(--middle-color);
|
|
||||||
--deprecated: var(--bad-color);
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
pre { line-height: 125%; }
|
|
||||||
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
||||||
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
||||||
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
||||||
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
||||||
.highlight .hll { background-color: #ffffcc }
|
|
||||||
.highlight { background: #f8f8f8; }
|
|
||||||
.highlight .c { color: #3D7B7B; font-style: italic } /* Comment */
|
|
||||||
.highlight .err { border: 1px solid #F00 } /* Error */
|
|
||||||
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
|
|
||||||
.highlight .o { color: #666 } /* Operator */
|
|
||||||
.highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
|
|
||||||
.highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
|
|
||||||
.highlight .cp { color: #9C6500 } /* Comment.Preproc */
|
|
||||||
.highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
|
|
||||||
.highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
|
|
||||||
.highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
|
|
||||||
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
|
||||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
|
||||||
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
|
|
||||||
.highlight .gr { color: #E40000 } /* Generic.Error */
|
|
||||||
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
|
||||||
.highlight .gi { color: #008400 } /* Generic.Inserted */
|
|
||||||
.highlight .go { color: #717171 } /* Generic.Output */
|
|
||||||
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
|
|
||||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
|
||||||
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
|
||||||
.highlight .gt { color: #04D } /* Generic.Traceback */
|
|
||||||
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
|
|
||||||
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
|
|
||||||
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
|
|
||||||
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
|
|
||||||
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
|
|
||||||
.highlight .kt { color: #B00040 } /* Keyword.Type */
|
|
||||||
.highlight .m { color: #666 } /* Literal.Number */
|
|
||||||
.highlight .s { color: #BA2121 } /* Literal.String */
|
|
||||||
.highlight .na { color: #687822 } /* Name.Attribute */
|
|
||||||
.highlight .nb { color: #008000 } /* Name.Builtin */
|
|
||||||
.highlight .nc { color: #00F; font-weight: bold } /* Name.Class */
|
|
||||||
.highlight .no { color: #800 } /* Name.Constant */
|
|
||||||
.highlight .nd { color: #A2F } /* Name.Decorator */
|
|
||||||
.highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */
|
|
||||||
.highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
|
|
||||||
.highlight .nf { color: #00F } /* Name.Function */
|
|
||||||
.highlight .nl { color: #767600 } /* Name.Label */
|
|
||||||
.highlight .nn { color: #00F; font-weight: bold } /* Name.Namespace */
|
|
||||||
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
|
|
||||||
.highlight .nv { color: #19177C } /* Name.Variable */
|
|
||||||
.highlight .ow { color: #A2F; font-weight: bold } /* Operator.Word */
|
|
||||||
.highlight .w { color: #BBB } /* Text.Whitespace */
|
|
||||||
.highlight .mb { color: #666 } /* Literal.Number.Bin */
|
|
||||||
.highlight .mf { color: #666 } /* Literal.Number.Float */
|
|
||||||
.highlight .mh { color: #666 } /* Literal.Number.Hex */
|
|
||||||
.highlight .mi { color: #666 } /* Literal.Number.Integer */
|
|
||||||
.highlight .mo { color: #666 } /* Literal.Number.Oct */
|
|
||||||
.highlight .sa { color: #BA2121 } /* Literal.String.Affix */
|
|
||||||
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
|
|
||||||
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
|
|
||||||
.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */
|
|
||||||
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
|
|
||||||
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
|
|
||||||
.highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
|
|
||||||
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
|
|
||||||
.highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
|
|
||||||
.highlight .sx { color: #008000 } /* Literal.String.Other */
|
|
||||||
.highlight .sr { color: #A45A77 } /* Literal.String.Regex */
|
|
||||||
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
|
|
||||||
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
|
|
||||||
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
|
|
||||||
.highlight .fm { color: #00F } /* Name.Function.Magic */
|
|
||||||
.highlight .vc { color: #19177C } /* Name.Variable.Class */
|
|
||||||
.highlight .vg { color: #19177C } /* Name.Variable.Global */
|
|
||||||
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
|
|
||||||
.highlight .vm { color: #19177C } /* Name.Variable.Magic */
|
|
||||||
.highlight .il { color: #666 } /* Literal.Number.Integer.Long */
|
|
@ -1,85 +0,0 @@
|
|||||||
pre { line-height: 125%; }
|
|
||||||
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
||||||
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
||||||
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
||||||
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
||||||
.highlight .hll { background-color: #49483e }
|
|
||||||
.highlight { background: #272822; color: #F8F8F2 }
|
|
||||||
.highlight .c { color: #959077 } /* Comment */
|
|
||||||
.highlight .err { color: #ED007E; background-color: #1E0010 } /* Error */
|
|
||||||
.highlight .esc { color: #F8F8F2 } /* Escape */
|
|
||||||
.highlight .g { color: #F8F8F2 } /* Generic */
|
|
||||||
.highlight .k { color: #66D9EF } /* Keyword */
|
|
||||||
.highlight .l { color: #AE81FF } /* Literal */
|
|
||||||
.highlight .n { color: #F8F8F2 } /* Name */
|
|
||||||
.highlight .o { color: #FF4689 } /* Operator */
|
|
||||||
.highlight .x { color: #F8F8F2 } /* Other */
|
|
||||||
.highlight .p { color: #F8F8F2 } /* Punctuation */
|
|
||||||
.highlight .ch { color: #959077 } /* Comment.Hashbang */
|
|
||||||
.highlight .cm { color: #959077 } /* Comment.Multiline */
|
|
||||||
.highlight .cp { color: #959077 } /* Comment.Preproc */
|
|
||||||
.highlight .cpf { color: #959077 } /* Comment.PreprocFile */
|
|
||||||
.highlight .c1 { color: #959077 } /* Comment.Single */
|
|
||||||
.highlight .cs { color: #959077 } /* Comment.Special */
|
|
||||||
.highlight .gd { color: #FF4689 } /* Generic.Deleted */
|
|
||||||
.highlight .ge { color: #F8F8F2; font-style: italic } /* Generic.Emph */
|
|
||||||
.highlight .ges { color: #F8F8F2; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
|
|
||||||
.highlight .gr { color: #F8F8F2 } /* Generic.Error */
|
|
||||||
.highlight .gh { color: #F8F8F2 } /* Generic.Heading */
|
|
||||||
.highlight .gi { color: #A6E22E } /* Generic.Inserted */
|
|
||||||
.highlight .go { color: #66D9EF } /* Generic.Output */
|
|
||||||
.highlight .gp { color: #FF4689; font-weight: bold } /* Generic.Prompt */
|
|
||||||
.highlight .gs { color: #F8F8F2; font-weight: bold } /* Generic.Strong */
|
|
||||||
.highlight .gu { color: #959077 } /* Generic.Subheading */
|
|
||||||
.highlight .gt { color: #F8F8F2 } /* Generic.Traceback */
|
|
||||||
.highlight .kc { color: #66D9EF } /* Keyword.Constant */
|
|
||||||
.highlight .kd { color: #66D9EF } /* Keyword.Declaration */
|
|
||||||
.highlight .kn { color: #FF4689 } /* Keyword.Namespace */
|
|
||||||
.highlight .kp { color: #66D9EF } /* Keyword.Pseudo */
|
|
||||||
.highlight .kr { color: #66D9EF } /* Keyword.Reserved */
|
|
||||||
.highlight .kt { color: #66D9EF } /* Keyword.Type */
|
|
||||||
.highlight .ld { color: #E6DB74 } /* Literal.Date */
|
|
||||||
.highlight .m { color: #AE81FF } /* Literal.Number */
|
|
||||||
.highlight .s { color: #E6DB74 } /* Literal.String */
|
|
||||||
.highlight .na { color: #A6E22E } /* Name.Attribute */
|
|
||||||
.highlight .nb { color: #F8F8F2 } /* Name.Builtin */
|
|
||||||
.highlight .nc { color: #A6E22E } /* Name.Class */
|
|
||||||
.highlight .no { color: #66D9EF } /* Name.Constant */
|
|
||||||
.highlight .nd { color: #A6E22E } /* Name.Decorator */
|
|
||||||
.highlight .ni { color: #F8F8F2 } /* Name.Entity */
|
|
||||||
.highlight .ne { color: #A6E22E } /* Name.Exception */
|
|
||||||
.highlight .nf { color: #A6E22E } /* Name.Function */
|
|
||||||
.highlight .nl { color: #F8F8F2 } /* Name.Label */
|
|
||||||
.highlight .nn { color: #F8F8F2 } /* Name.Namespace */
|
|
||||||
.highlight .nx { color: #A6E22E } /* Name.Other */
|
|
||||||
.highlight .py { color: #F8F8F2 } /* Name.Property */
|
|
||||||
.highlight .nt { color: #FF4689 } /* Name.Tag */
|
|
||||||
.highlight .nv { color: #F8F8F2 } /* Name.Variable */
|
|
||||||
.highlight .ow { color: #FF4689 } /* Operator.Word */
|
|
||||||
.highlight .pm { color: #F8F8F2 } /* Punctuation.Marker */
|
|
||||||
.highlight .w { color: #F8F8F2 } /* Text.Whitespace */
|
|
||||||
.highlight .mb { color: #AE81FF } /* Literal.Number.Bin */
|
|
||||||
.highlight .mf { color: #AE81FF } /* Literal.Number.Float */
|
|
||||||
.highlight .mh { color: #AE81FF } /* Literal.Number.Hex */
|
|
||||||
.highlight .mi { color: #AE81FF } /* Literal.Number.Integer */
|
|
||||||
.highlight .mo { color: #AE81FF } /* Literal.Number.Oct */
|
|
||||||
.highlight .sa { color: #E6DB74 } /* Literal.String.Affix */
|
|
||||||
.highlight .sb { color: #E6DB74 } /* Literal.String.Backtick */
|
|
||||||
.highlight .sc { color: #E6DB74 } /* Literal.String.Char */
|
|
||||||
.highlight .dl { color: #E6DB74 } /* Literal.String.Delimiter */
|
|
||||||
.highlight .sd { color: #E6DB74 } /* Literal.String.Doc */
|
|
||||||
.highlight .s2 { color: #E6DB74 } /* Literal.String.Double */
|
|
||||||
.highlight .se { color: #AE81FF } /* Literal.String.Escape */
|
|
||||||
.highlight .sh { color: #E6DB74 } /* Literal.String.Heredoc */
|
|
||||||
.highlight .si { color: #E6DB74 } /* Literal.String.Interpol */
|
|
||||||
.highlight .sx { color: #E6DB74 } /* Literal.String.Other */
|
|
||||||
.highlight .sr { color: #E6DB74 } /* Literal.String.Regex */
|
|
||||||
.highlight .s1 { color: #E6DB74 } /* Literal.String.Single */
|
|
||||||
.highlight .ss { color: #E6DB74 } /* Literal.String.Symbol */
|
|
||||||
.highlight .bp { color: #F8F8F2 } /* Name.Builtin.Pseudo */
|
|
||||||
.highlight .fm { color: #A6E22E } /* Name.Function.Magic */
|
|
||||||
.highlight .vc { color: #F8F8F2 } /* Name.Variable.Class */
|
|
||||||
.highlight .vg { color: #F8F8F2 } /* Name.Variable.Global */
|
|
||||||
.highlight .vi { color: #F8F8F2 } /* Name.Variable.Instance */
|
|
||||||
.highlight .vm { color: #F8F8F2 } /* Name.Variable.Magic */
|
|
||||||
.highlight .il { color: #AE81FF } /* Literal.Number.Integer.Long */
|
|
@ -1,55 +0,0 @@
|
|||||||
function onSwitch(event) {
|
|
||||||
const option = event.target.selectedIndex;
|
|
||||||
const item = event.target.options[option];
|
|
||||||
window.location.href = item.dataset.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("readthedocs-addons-data-ready", function(event) {
|
|
||||||
const config = event.detail.data()
|
|
||||||
const versionSelect = `
|
|
||||||
<select id="version_select" aria-label="Python version">
|
|
||||||
${ config.versions.active.map(
|
|
||||||
(version) => `
|
|
||||||
<option
|
|
||||||
value="${ version.slug }"
|
|
||||||
${ config.versions.current.slug === version.slug ? 'selected="selected"' : '' }
|
|
||||||
data-url="${ version.urls.documentation }">
|
|
||||||
${ version.slug }
|
|
||||||
</option>`
|
|
||||||
).join("\n") }
|
|
||||||
</select>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Prepend the current language to the options on the selector
|
|
||||||
let languages = config.projects.translations.concat(config.projects.current);
|
|
||||||
languages = languages.sort((a, b) => a.language.name.localeCompare(b.language.name));
|
|
||||||
|
|
||||||
const languageSelect = `
|
|
||||||
<select id="language_select" aria-label="Language">
|
|
||||||
${ languages.map(
|
|
||||||
(translation) => `
|
|
||||||
<option
|
|
||||||
value="${ translation.slug }"
|
|
||||||
${ config.projects.current.slug === translation.slug ? 'selected="selected"' : '' }
|
|
||||||
data-url="${ translation.urls.documentation }">
|
|
||||||
${ translation.language.name }
|
|
||||||
</option>`
|
|
||||||
).join("\n") }
|
|
||||||
</select>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Query all the placeholders because there are different ones for Desktop/Mobile
|
|
||||||
const versionPlaceholders = document.querySelectorAll(".version_switcher_placeholder");
|
|
||||||
for (placeholder of versionPlaceholders) {
|
|
||||||
placeholder.innerHTML = versionSelect;
|
|
||||||
let selectElement = placeholder.querySelector("select");
|
|
||||||
selectElement.addEventListener("change", onSwitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
const languagePlaceholders = document.querySelectorAll(".language_switcher_placeholder");
|
|
||||||
for (placeholder of languagePlaceholders) {
|
|
||||||
placeholder.innerHTML = languageSelect;
|
|
||||||
let selectElement = placeholder.querySelector("select");
|
|
||||||
selectElement.addEventListener("change", onSwitch);
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,21 +0,0 @@
|
|||||||
function isInputFocused() {
|
|
||||||
const activeElement = document.activeElement;
|
|
||||||
return (
|
|
||||||
activeElement.tagName === 'INPUT' ||
|
|
||||||
activeElement.tagName === 'TEXTAREA' ||
|
|
||||||
activeElement.isContentEditable
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('keydown', function(event) {
|
|
||||||
if (event.key === '/') {
|
|
||||||
if (!isInputFocused()) {
|
|
||||||
// Prevent "/" from being entered in the search box
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
// Set the focus on the search box
|
|
||||||
const searchBox = document.getElementById('search-box');
|
|
||||||
searchBox.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
635
Dependencies/Python/Doc/html/_static/searchtools.js
vendored
@ -1,635 +0,0 @@
|
|||||||
/*
|
|
||||||
* Sphinx JavaScript utilities for the full-text search.
|
|
||||||
*/
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple result scoring code.
|
|
||||||
*/
|
|
||||||
if (typeof Scorer === "undefined") {
|
|
||||||
var Scorer = {
|
|
||||||
// Implement the following function to further tweak the score for each result
|
|
||||||
// The function takes a result array [docname, title, anchor, descr, score, filename]
|
|
||||||
// and returns the new score.
|
|
||||||
/*
|
|
||||||
score: result => {
|
|
||||||
const [docname, title, anchor, descr, score, filename, kind] = result
|
|
||||||
return score
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
// query matches the full name of an object
|
|
||||||
objNameMatch: 11,
|
|
||||||
// or matches in the last dotted part of the object name
|
|
||||||
objPartialMatch: 6,
|
|
||||||
// Additive scores depending on the priority of the object
|
|
||||||
objPrio: {
|
|
||||||
0: 15, // used to be importantResults
|
|
||||||
1: 5, // used to be objectResults
|
|
||||||
2: -5, // used to be unimportantResults
|
|
||||||
},
|
|
||||||
// Used when the priority is not in the mapping.
|
|
||||||
objPrioDefault: 0,
|
|
||||||
|
|
||||||
// query found in title
|
|
||||||
title: 15,
|
|
||||||
partialTitle: 7,
|
|
||||||
// query found in terms
|
|
||||||
term: 5,
|
|
||||||
partialTerm: 2,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global search result kind enum, used by themes to style search results.
|
|
||||||
class SearchResultKind {
|
|
||||||
static get index() { return "index"; }
|
|
||||||
static get object() { return "object"; }
|
|
||||||
static get text() { return "text"; }
|
|
||||||
static get title() { return "title"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
const _removeChildren = (element) => {
|
|
||||||
while (element && element.lastChild) element.removeChild(element.lastChild);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
|
||||||
*/
|
|
||||||
const _escapeRegExp = (string) =>
|
|
||||||
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
||||||
|
|
||||||
const _displayItem = (item, searchTerms, highlightTerms) => {
|
|
||||||
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
|
|
||||||
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
|
|
||||||
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
|
|
||||||
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
|
|
||||||
const contentRoot = document.documentElement.dataset.content_root;
|
|
||||||
|
|
||||||
const [docName, title, anchor, descr, score, _filename, kind] = item;
|
|
||||||
|
|
||||||
let listItem = document.createElement("li");
|
|
||||||
// Add a class representing the item's type:
|
|
||||||
// can be used by a theme's CSS selector for styling
|
|
||||||
// See SearchResultKind for the class names.
|
|
||||||
listItem.classList.add(`kind-${kind}`);
|
|
||||||
let requestUrl;
|
|
||||||
let linkUrl;
|
|
||||||
if (docBuilder === "dirhtml") {
|
|
||||||
// dirhtml builder
|
|
||||||
let dirname = docName + "/";
|
|
||||||
if (dirname.match(/\/index\/$/))
|
|
||||||
dirname = dirname.substring(0, dirname.length - 6);
|
|
||||||
else if (dirname === "index/") dirname = "";
|
|
||||||
requestUrl = contentRoot + dirname;
|
|
||||||
linkUrl = requestUrl;
|
|
||||||
} else {
|
|
||||||
// normal html builders
|
|
||||||
requestUrl = contentRoot + docName + docFileSuffix;
|
|
||||||
linkUrl = docName + docLinkSuffix;
|
|
||||||
}
|
|
||||||
let linkEl = listItem.appendChild(document.createElement("a"));
|
|
||||||
linkEl.href = linkUrl + anchor;
|
|
||||||
linkEl.dataset.score = score;
|
|
||||||
linkEl.innerHTML = title;
|
|
||||||
if (descr) {
|
|
||||||
listItem.appendChild(document.createElement("span")).innerHTML =
|
|
||||||
" (" + descr + ")";
|
|
||||||
// highlight search terms in the description
|
|
||||||
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
|
|
||||||
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
|
|
||||||
}
|
|
||||||
else if (showSearchSummary)
|
|
||||||
fetch(requestUrl)
|
|
||||||
.then((responseData) => responseData.text())
|
|
||||||
.then((data) => {
|
|
||||||
if (data)
|
|
||||||
listItem.appendChild(
|
|
||||||
Search.makeSearchSummary(data, searchTerms, anchor)
|
|
||||||
);
|
|
||||||
// highlight search terms in the summary
|
|
||||||
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
|
|
||||||
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
|
|
||||||
});
|
|
||||||
Search.output.appendChild(listItem);
|
|
||||||
};
|
|
||||||
const _finishSearch = (resultCount) => {
|
|
||||||
Search.stopPulse();
|
|
||||||
Search.title.innerText = _("Search Results");
|
|
||||||
if (!resultCount)
|
|
||||||
Search.status.innerText = Documentation.gettext(
|
|
||||||
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
|
|
||||||
);
|
|
||||||
else
|
|
||||||
Search.status.innerText = Documentation.ngettext(
|
|
||||||
"Search finished, found one page matching the search query.",
|
|
||||||
"Search finished, found ${resultCount} pages matching the search query.",
|
|
||||||
resultCount,
|
|
||||||
).replace('${resultCount}', resultCount);
|
|
||||||
};
|
|
||||||
const _displayNextItem = (
|
|
||||||
results,
|
|
||||||
resultCount,
|
|
||||||
searchTerms,
|
|
||||||
highlightTerms,
|
|
||||||
) => {
|
|
||||||
// results left, load the summary and display it
|
|
||||||
// this is intended to be dynamic (don't sub resultsCount)
|
|
||||||
if (results.length) {
|
|
||||||
_displayItem(results.pop(), searchTerms, highlightTerms);
|
|
||||||
setTimeout(
|
|
||||||
() => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
|
|
||||||
5
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// search finished, update title and status message
|
|
||||||
else _finishSearch(resultCount);
|
|
||||||
};
|
|
||||||
// Helper function used by query() to order search results.
|
|
||||||
// Each input is an array of [docname, title, anchor, descr, score, filename, kind].
|
|
||||||
// Order the results by score (in opposite order of appearance, since the
|
|
||||||
// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
|
|
||||||
const _orderResultsByScoreThenName = (a, b) => {
|
|
||||||
const leftScore = a[4];
|
|
||||||
const rightScore = b[4];
|
|
||||||
if (leftScore === rightScore) {
|
|
||||||
// same score: sort alphabetically
|
|
||||||
const leftTitle = a[1].toLowerCase();
|
|
||||||
const rightTitle = b[1].toLowerCase();
|
|
||||||
if (leftTitle === rightTitle) return 0;
|
|
||||||
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
|
|
||||||
}
|
|
||||||
return leftScore > rightScore ? 1 : -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
|
|
||||||
* custom function per language.
|
|
||||||
*
|
|
||||||
* The regular expression works by splitting the string on consecutive characters
|
|
||||||
* that are not Unicode letters, numbers, underscores, or emoji characters.
|
|
||||||
* This is the same as ``\W+`` in Python, preserving the surrogate pair area.
|
|
||||||
*/
|
|
||||||
if (typeof splitQuery === "undefined") {
|
|
||||||
var splitQuery = (query) => query
|
|
||||||
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu)
|
|
||||||
.filter(term => term) // remove remaining empty strings
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search Module
|
|
||||||
*/
|
|
||||||
const Search = {
|
|
||||||
_index: null,
|
|
||||||
_queued_query: null,
|
|
||||||
_pulse_status: -1,
|
|
||||||
|
|
||||||
htmlToText: (htmlString, anchor) => {
|
|
||||||
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
|
|
||||||
for (const removalQuery of [".headerlink", "script", "style"]) {
|
|
||||||
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
|
|
||||||
}
|
|
||||||
if (anchor) {
|
|
||||||
const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
|
|
||||||
if (anchorContent) return anchorContent.textContent;
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
`Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if anchor not specified or not found, fall back to main content
|
|
||||||
const docContent = htmlElement.querySelector('[role="main"]');
|
|
||||||
if (docContent) return docContent.textContent;
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
"Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
|
|
||||||
);
|
|
||||||
return "";
|
|
||||||
},
|
|
||||||
|
|
||||||
init: () => {
|
|
||||||
const query = new URLSearchParams(window.location.search).get("q");
|
|
||||||
document
|
|
||||||
.querySelectorAll('input[name="q"]')
|
|
||||||
.forEach((el) => (el.value = query));
|
|
||||||
if (query) Search.performSearch(query);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadIndex: (url) =>
|
|
||||||
(document.body.appendChild(document.createElement("script")).src = url),
|
|
||||||
|
|
||||||
setIndex: (index) => {
|
|
||||||
Search._index = index;
|
|
||||||
if (Search._queued_query !== null) {
|
|
||||||
const query = Search._queued_query;
|
|
||||||
Search._queued_query = null;
|
|
||||||
Search.query(query);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
hasIndex: () => Search._index !== null,
|
|
||||||
|
|
||||||
deferQuery: (query) => (Search._queued_query = query),
|
|
||||||
|
|
||||||
stopPulse: () => (Search._pulse_status = -1),
|
|
||||||
|
|
||||||
startPulse: () => {
|
|
||||||
if (Search._pulse_status >= 0) return;
|
|
||||||
|
|
||||||
const pulse = () => {
|
|
||||||
Search._pulse_status = (Search._pulse_status + 1) % 4;
|
|
||||||
Search.dots.innerText = ".".repeat(Search._pulse_status);
|
|
||||||
if (Search._pulse_status >= 0) window.setTimeout(pulse, 500);
|
|
||||||
};
|
|
||||||
pulse();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* perform a search for something (or wait until index is loaded)
|
|
||||||
*/
|
|
||||||
performSearch: (query) => {
|
|
||||||
// create the required interface elements
|
|
||||||
const searchText = document.createElement("h2");
|
|
||||||
searchText.textContent = _("Searching");
|
|
||||||
const searchSummary = document.createElement("p");
|
|
||||||
searchSummary.classList.add("search-summary");
|
|
||||||
searchSummary.innerText = "";
|
|
||||||
const searchList = document.createElement("ul");
|
|
||||||
searchList.setAttribute("role", "list");
|
|
||||||
searchList.classList.add("search");
|
|
||||||
|
|
||||||
const out = document.getElementById("search-results");
|
|
||||||
Search.title = out.appendChild(searchText);
|
|
||||||
Search.dots = Search.title.appendChild(document.createElement("span"));
|
|
||||||
Search.status = out.appendChild(searchSummary);
|
|
||||||
Search.output = out.appendChild(searchList);
|
|
||||||
|
|
||||||
const searchProgress = document.getElementById("search-progress");
|
|
||||||
// Some themes don't use the search progress node
|
|
||||||
if (searchProgress) {
|
|
||||||
searchProgress.innerText = _("Preparing search...");
|
|
||||||
}
|
|
||||||
Search.startPulse();
|
|
||||||
|
|
||||||
// index already loaded, the browser was quick!
|
|
||||||
if (Search.hasIndex()) Search.query(query);
|
|
||||||
else Search.deferQuery(query);
|
|
||||||
},
|
|
||||||
|
|
||||||
_parseQuery: (query) => {
|
|
||||||
// stem the search terms and add them to the correct list
|
|
||||||
const stemmer = new Stemmer();
|
|
||||||
const searchTerms = new Set();
|
|
||||||
const excludedTerms = new Set();
|
|
||||||
const highlightTerms = new Set();
|
|
||||||
const objectTerms = new Set(splitQuery(query.toLowerCase().trim()));
|
|
||||||
splitQuery(query.trim()).forEach((queryTerm) => {
|
|
||||||
const queryTermLower = queryTerm.toLowerCase();
|
|
||||||
|
|
||||||
// maybe skip this "word"
|
|
||||||
// stopwords array is from language_data.js
|
|
||||||
if (
|
|
||||||
stopwords.indexOf(queryTermLower) !== -1 ||
|
|
||||||
queryTerm.match(/^\d+$/)
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// stem the word
|
|
||||||
let word = stemmer.stemWord(queryTermLower);
|
|
||||||
// select the correct list
|
|
||||||
if (word[0] === "-") excludedTerms.add(word.substr(1));
|
|
||||||
else {
|
|
||||||
searchTerms.add(word);
|
|
||||||
highlightTerms.add(queryTermLower);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js
|
|
||||||
localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" "))
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.debug("SEARCH: searching for:");
|
|
||||||
// console.info("required: ", [...searchTerms]);
|
|
||||||
// console.info("excluded: ", [...excludedTerms]);
|
|
||||||
|
|
||||||
return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* execute search (requires search index to be loaded)
|
|
||||||
*/
|
|
||||||
_performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
|
|
||||||
const filenames = Search._index.filenames;
|
|
||||||
const docNames = Search._index.docnames;
|
|
||||||
const titles = Search._index.titles;
|
|
||||||
const allTitles = Search._index.alltitles;
|
|
||||||
const indexEntries = Search._index.indexentries;
|
|
||||||
|
|
||||||
// Collect multiple result groups to be sorted separately and then ordered.
|
|
||||||
// Each is an array of [docname, title, anchor, descr, score, filename, kind].
|
|
||||||
const normalResults = [];
|
|
||||||
const nonMainIndexResults = [];
|
|
||||||
|
|
||||||
_removeChildren(document.getElementById("search-progress"));
|
|
||||||
|
|
||||||
const queryLower = query.toLowerCase().trim();
|
|
||||||
for (const [title, foundTitles] of Object.entries(allTitles)) {
|
|
||||||
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
|
|
||||||
for (const [file, id] of foundTitles) {
|
|
||||||
const score = Math.round(Scorer.title * queryLower.length / title.length);
|
|
||||||
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
|
|
||||||
normalResults.push([
|
|
||||||
docNames[file],
|
|
||||||
titles[file] !== title ? `${titles[file]} > ${title}` : title,
|
|
||||||
id !== null ? "#" + id : "",
|
|
||||||
null,
|
|
||||||
score + boost,
|
|
||||||
filenames[file],
|
|
||||||
SearchResultKind.title,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// search for explicit entries in index directives
|
|
||||||
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
|
|
||||||
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
|
|
||||||
for (const [file, id, isMain] of foundEntries) {
|
|
||||||
const score = Math.round(100 * queryLower.length / entry.length);
|
|
||||||
const result = [
|
|
||||||
docNames[file],
|
|
||||||
titles[file],
|
|
||||||
id ? "#" + id : "",
|
|
||||||
null,
|
|
||||||
score,
|
|
||||||
filenames[file],
|
|
||||||
SearchResultKind.index,
|
|
||||||
];
|
|
||||||
if (isMain) {
|
|
||||||
normalResults.push(result);
|
|
||||||
} else {
|
|
||||||
nonMainIndexResults.push(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// lookup as object
|
|
||||||
objectTerms.forEach((term) =>
|
|
||||||
normalResults.push(...Search.performObjectSearch(term, objectTerms))
|
|
||||||
);
|
|
||||||
|
|
||||||
// lookup as search terms in fulltext
|
|
||||||
normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
|
|
||||||
|
|
||||||
// let the scorer override scores with a custom scoring function
|
|
||||||
if (Scorer.score) {
|
|
||||||
normalResults.forEach((item) => (item[4] = Scorer.score(item)));
|
|
||||||
nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort each group of results by score and then alphabetically by name.
|
|
||||||
normalResults.sort(_orderResultsByScoreThenName);
|
|
||||||
nonMainIndexResults.sort(_orderResultsByScoreThenName);
|
|
||||||
|
|
||||||
// Combine the result groups in (reverse) order.
|
|
||||||
// Non-main index entries are typically arbitrary cross-references,
|
|
||||||
// so display them after other results.
|
|
||||||
let results = [...nonMainIndexResults, ...normalResults];
|
|
||||||
|
|
||||||
// remove duplicate search results
|
|
||||||
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
|
|
||||||
let seen = new Set();
|
|
||||||
results = results.reverse().reduce((acc, result) => {
|
|
||||||
let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(',');
|
|
||||||
if (!seen.has(resultStr)) {
|
|
||||||
acc.push(result);
|
|
||||||
seen.add(resultStr);
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return results.reverse();
|
|
||||||
},
|
|
||||||
|
|
||||||
query: (query) => {
|
|
||||||
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
|
|
||||||
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
|
|
||||||
|
|
||||||
// for debugging
|
|
||||||
//Search.lastresults = results.slice(); // a copy
|
|
||||||
// console.info("search results:", Search.lastresults);
|
|
||||||
|
|
||||||
// print the results
|
|
||||||
_displayNextItem(results, results.length, searchTerms, highlightTerms);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* search for object names
|
|
||||||
*/
|
|
||||||
performObjectSearch: (object, objectTerms) => {
|
|
||||||
const filenames = Search._index.filenames;
|
|
||||||
const docNames = Search._index.docnames;
|
|
||||||
const objects = Search._index.objects;
|
|
||||||
const objNames = Search._index.objnames;
|
|
||||||
const titles = Search._index.titles;
|
|
||||||
|
|
||||||
const results = [];
|
|
||||||
|
|
||||||
const objectSearchCallback = (prefix, match) => {
|
|
||||||
const name = match[4]
|
|
||||||
const fullname = (prefix ? prefix + "." : "") + name;
|
|
||||||
const fullnameLower = fullname.toLowerCase();
|
|
||||||
if (fullnameLower.indexOf(object) < 0) return;
|
|
||||||
|
|
||||||
let score = 0;
|
|
||||||
const parts = fullnameLower.split(".");
|
|
||||||
|
|
||||||
// check for different match types: exact matches of full name or
|
|
||||||
// "last name" (i.e. last dotted part)
|
|
||||||
if (fullnameLower === object || parts.slice(-1)[0] === object)
|
|
||||||
score += Scorer.objNameMatch;
|
|
||||||
else if (parts.slice(-1)[0].indexOf(object) > -1)
|
|
||||||
score += Scorer.objPartialMatch; // matches in last name
|
|
||||||
|
|
||||||
const objName = objNames[match[1]][2];
|
|
||||||
const title = titles[match[0]];
|
|
||||||
|
|
||||||
// If more than one term searched for, we require other words to be
|
|
||||||
// found in the name/title/description
|
|
||||||
const otherTerms = new Set(objectTerms);
|
|
||||||
otherTerms.delete(object);
|
|
||||||
if (otherTerms.size > 0) {
|
|
||||||
const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase();
|
|
||||||
if (
|
|
||||||
[...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0)
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let anchor = match[3];
|
|
||||||
if (anchor === "") anchor = fullname;
|
|
||||||
else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname;
|
|
||||||
|
|
||||||
const descr = objName + _(", in ") + title;
|
|
||||||
|
|
||||||
// add custom score for some objects according to scorer
|
|
||||||
if (Scorer.objPrio.hasOwnProperty(match[2]))
|
|
||||||
score += Scorer.objPrio[match[2]];
|
|
||||||
else score += Scorer.objPrioDefault;
|
|
||||||
|
|
||||||
results.push([
|
|
||||||
docNames[match[0]],
|
|
||||||
fullname,
|
|
||||||
"#" + anchor,
|
|
||||||
descr,
|
|
||||||
score,
|
|
||||||
filenames[match[0]],
|
|
||||||
SearchResultKind.object,
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
Object.keys(objects).forEach((prefix) =>
|
|
||||||
objects[prefix].forEach((array) =>
|
|
||||||
objectSearchCallback(prefix, array)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return results;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* search for full-text terms in the index
|
|
||||||
*/
|
|
||||||
performTermsSearch: (searchTerms, excludedTerms) => {
|
|
||||||
// prepare search
|
|
||||||
const terms = Search._index.terms;
|
|
||||||
const titleTerms = Search._index.titleterms;
|
|
||||||
const filenames = Search._index.filenames;
|
|
||||||
const docNames = Search._index.docnames;
|
|
||||||
const titles = Search._index.titles;
|
|
||||||
|
|
||||||
const scoreMap = new Map();
|
|
||||||
const fileMap = new Map();
|
|
||||||
|
|
||||||
// perform the search on the required terms
|
|
||||||
searchTerms.forEach((word) => {
|
|
||||||
const files = [];
|
|
||||||
// find documents, if any, containing the query word in their text/title term indices
|
|
||||||
// use Object.hasOwnProperty to avoid mismatching against prototype properties
|
|
||||||
const arr = [
|
|
||||||
{ files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term },
|
|
||||||
{ files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title },
|
|
||||||
];
|
|
||||||
// add support for partial matches
|
|
||||||
if (word.length > 2) {
|
|
||||||
const escapedWord = _escapeRegExp(word);
|
|
||||||
if (!terms.hasOwnProperty(word)) {
|
|
||||||
Object.keys(terms).forEach((term) => {
|
|
||||||
if (term.match(escapedWord))
|
|
||||||
arr.push({ files: terms[term], score: Scorer.partialTerm });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!titleTerms.hasOwnProperty(word)) {
|
|
||||||
Object.keys(titleTerms).forEach((term) => {
|
|
||||||
if (term.match(escapedWord))
|
|
||||||
arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no match but word was a required one
|
|
||||||
if (arr.every((record) => record.files === undefined)) return;
|
|
||||||
|
|
||||||
// found search word in contents
|
|
||||||
arr.forEach((record) => {
|
|
||||||
if (record.files === undefined) return;
|
|
||||||
|
|
||||||
let recordFiles = record.files;
|
|
||||||
if (recordFiles.length === undefined) recordFiles = [recordFiles];
|
|
||||||
files.push(...recordFiles);
|
|
||||||
|
|
||||||
// set score for the word in each file
|
|
||||||
recordFiles.forEach((file) => {
|
|
||||||
if (!scoreMap.has(file)) scoreMap.set(file, new Map());
|
|
||||||
const fileScores = scoreMap.get(file);
|
|
||||||
fileScores.set(word, record.score);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// create the mapping
|
|
||||||
files.forEach((file) => {
|
|
||||||
if (!fileMap.has(file)) fileMap.set(file, [word]);
|
|
||||||
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// now check if the files don't contain excluded terms
|
|
||||||
const results = [];
|
|
||||||
for (const [file, wordList] of fileMap) {
|
|
||||||
// check if all requirements are matched
|
|
||||||
|
|
||||||
// as search terms with length < 3 are discarded
|
|
||||||
const filteredTermCount = [...searchTerms].filter(
|
|
||||||
(term) => term.length > 2
|
|
||||||
).length;
|
|
||||||
if (
|
|
||||||
wordList.length !== searchTerms.size &&
|
|
||||||
wordList.length !== filteredTermCount
|
|
||||||
)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// ensure that none of the excluded terms is in the search result
|
|
||||||
if (
|
|
||||||
[...excludedTerms].some(
|
|
||||||
(term) =>
|
|
||||||
terms[term] === file ||
|
|
||||||
titleTerms[term] === file ||
|
|
||||||
(terms[term] || []).includes(file) ||
|
|
||||||
(titleTerms[term] || []).includes(file)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// select one (max) score for the file.
|
|
||||||
const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w)));
|
|
||||||
// add result to the result list
|
|
||||||
results.push([
|
|
||||||
docNames[file],
|
|
||||||
titles[file],
|
|
||||||
"",
|
|
||||||
null,
|
|
||||||
score,
|
|
||||||
filenames[file],
|
|
||||||
SearchResultKind.text,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper function to return a node containing the
|
|
||||||
* search summary for a given text. keywords is a list
|
|
||||||
* of stemmed words.
|
|
||||||
*/
|
|
||||||
makeSearchSummary: (htmlText, keywords, anchor) => {
|
|
||||||
const text = Search.htmlToText(htmlText, anchor);
|
|
||||||
if (text === "") return null;
|
|
||||||
|
|
||||||
const textLower = text.toLowerCase();
|
|
||||||
const actualStartPosition = [...keywords]
|
|
||||||
.map((k) => textLower.indexOf(k.toLowerCase()))
|
|
||||||
.filter((i) => i > -1)
|
|
||||||
.slice(-1)[0];
|
|
||||||
const startWithContext = Math.max(actualStartPosition - 120, 0);
|
|
||||||
|
|
||||||
const top = startWithContext === 0 ? "" : "...";
|
|
||||||
const tail = startWithContext + 240 < text.length ? "..." : "";
|
|
||||||
|
|
||||||
let summary = document.createElement("p");
|
|
||||||
summary.classList.add("context");
|
|
||||||
summary.textContent = top + text.substr(startWithContext, 240).trim() + tail;
|
|
||||||
|
|
||||||
return summary;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
_ready(Search.init);
|
|
81
Dependencies/Python/Doc/html/_static/sidebar.js
vendored
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* sidebar.js
|
|
||||||
* ~~~~~~~~~~
|
|
||||||
*
|
|
||||||
* This file is functionally identical to "sidebar.js" in Sphinx 5.0.
|
|
||||||
* When support for Sphinx 4 and earlier is dropped from the theme,
|
|
||||||
* this file can be removed.
|
|
||||||
*
|
|
||||||
* This script makes the Sphinx sidebar collapsible.
|
|
||||||
*
|
|
||||||
* .sphinxsidebar contains .sphinxsidebarwrapper. This script adds
|
|
||||||
* in .sphinxsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
|
|
||||||
* used to collapse and expand the sidebar.
|
|
||||||
*
|
|
||||||
* When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
|
|
||||||
* and the width of the sidebar and the margin-left of the document
|
|
||||||
* are decreased. When the sidebar is expanded the opposite happens.
|
|
||||||
* This script saves a per-browser/per-session cookie used to
|
|
||||||
* remember the position of the sidebar among the pages.
|
|
||||||
* Once the browser is closed the cookie is deleted and the position
|
|
||||||
* reset to the default (expanded).
|
|
||||||
*
|
|
||||||
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
|
|
||||||
* :license: BSD, see LICENSE for details.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const initialiseSidebar = () => {
|
|
||||||
// global elements used by the functions.
|
|
||||||
const bodyWrapper = document.getElementsByClassName("bodywrapper")[0]
|
|
||||||
const sidebar = document.getElementsByClassName("sphinxsidebar")[0]
|
|
||||||
const sidebarWrapper = document.getElementsByClassName("sphinxsidebarwrapper")[0]
|
|
||||||
|
|
||||||
// exit early if the document has no sidebar for some reason
|
|
||||||
if (typeof sidebar === "undefined") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const sidebarButton = document.getElementById("sidebarbutton")
|
|
||||||
const sidebarArrow = sidebarButton.querySelector('span')
|
|
||||||
|
|
||||||
|
|
||||||
const collapse_sidebar = () => {
|
|
||||||
bodyWrapper.style.marginLeft = ".8em"
|
|
||||||
sidebar.style.width = ".8em"
|
|
||||||
sidebarWrapper.style.display = "none"
|
|
||||||
sidebarArrow.innerText = "»"
|
|
||||||
sidebarButton.title = _("Expand sidebar")
|
|
||||||
window.localStorage.setItem("sidebar", "collapsed")
|
|
||||||
}
|
|
||||||
|
|
||||||
const expand_sidebar = () => {
|
|
||||||
bodyWrapper.style.marginLeft = ""
|
|
||||||
sidebar.style.removeProperty("width")
|
|
||||||
sidebarWrapper.style.display = ""
|
|
||||||
sidebarArrow.innerText = "«"
|
|
||||||
sidebarButton.title = _("Collapse sidebar")
|
|
||||||
window.localStorage.setItem("sidebar", "expanded")
|
|
||||||
}
|
|
||||||
|
|
||||||
sidebarButton.addEventListener("click", () => {
|
|
||||||
(sidebarWrapper.style.display === "none") ? expand_sidebar() : collapse_sidebar()
|
|
||||||
})
|
|
||||||
|
|
||||||
const sidebar_state = window.localStorage.getItem("sidebar")
|
|
||||||
if (sidebar_state === "collapsed") {
|
|
||||||
collapse_sidebar()
|
|
||||||
}
|
|
||||||
else if (sidebar_state === "expanded") {
|
|
||||||
expand_sidebar()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState !== "loading") {
|
|
||||||
initialiseSidebar()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
document.addEventListener("DOMContentLoaded", initialiseSidebar)
|
|
||||||
}
|
|
@ -1,154 +0,0 @@
|
|||||||
/* Highlighting utilities for Sphinx HTML documentation. */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const SPHINX_HIGHLIGHT_ENABLED = true
|
|
||||||
|
|
||||||
/**
|
|
||||||
* highlight a given string on a node by wrapping it in
|
|
||||||
* span elements with the given class name.
|
|
||||||
*/
|
|
||||||
const _highlight = (node, addItems, text, className) => {
|
|
||||||
if (node.nodeType === Node.TEXT_NODE) {
|
|
||||||
const val = node.nodeValue;
|
|
||||||
const parent = node.parentNode;
|
|
||||||
const pos = val.toLowerCase().indexOf(text);
|
|
||||||
if (
|
|
||||||
pos >= 0 &&
|
|
||||||
!parent.classList.contains(className) &&
|
|
||||||
!parent.classList.contains("nohighlight")
|
|
||||||
) {
|
|
||||||
let span;
|
|
||||||
|
|
||||||
const closestNode = parent.closest("body, svg, foreignObject");
|
|
||||||
const isInSVG = closestNode && closestNode.matches("svg");
|
|
||||||
if (isInSVG) {
|
|
||||||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
||||||
} else {
|
|
||||||
span = document.createElement("span");
|
|
||||||
span.classList.add(className);
|
|
||||||
}
|
|
||||||
|
|
||||||
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
|
||||||
const rest = document.createTextNode(val.substr(pos + text.length));
|
|
||||||
parent.insertBefore(
|
|
||||||
span,
|
|
||||||
parent.insertBefore(
|
|
||||||
rest,
|
|
||||||
node.nextSibling
|
|
||||||
)
|
|
||||||
);
|
|
||||||
node.nodeValue = val.substr(0, pos);
|
|
||||||
/* There may be more occurrences of search term in this node. So call this
|
|
||||||
* function recursively on the remaining fragment.
|
|
||||||
*/
|
|
||||||
_highlight(rest, addItems, text, className);
|
|
||||||
|
|
||||||
if (isInSVG) {
|
|
||||||
const rect = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg",
|
|
||||||
"rect"
|
|
||||||
);
|
|
||||||
const bbox = parent.getBBox();
|
|
||||||
rect.x.baseVal.value = bbox.x;
|
|
||||||
rect.y.baseVal.value = bbox.y;
|
|
||||||
rect.width.baseVal.value = bbox.width;
|
|
||||||
rect.height.baseVal.value = bbox.height;
|
|
||||||
rect.setAttribute("class", className);
|
|
||||||
addItems.push({ parent: parent, target: rect });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (node.matches && !node.matches("button, select, textarea")) {
|
|
||||||
node.childNodes.forEach((el) => _highlight(el, addItems, text, className));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const _highlightText = (thisNode, text, className) => {
|
|
||||||
let addItems = [];
|
|
||||||
_highlight(thisNode, addItems, text, className);
|
|
||||||
addItems.forEach((obj) =>
|
|
||||||
obj.parent.insertAdjacentElement("beforebegin", obj.target)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Small JavaScript module for the documentation.
|
|
||||||
*/
|
|
||||||
const SphinxHighlight = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* highlight the search words provided in localstorage in the text
|
|
||||||
*/
|
|
||||||
highlightSearchWords: () => {
|
|
||||||
if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight
|
|
||||||
|
|
||||||
// get and clear terms from localstorage
|
|
||||||
const url = new URL(window.location);
|
|
||||||
const highlight =
|
|
||||||
localStorage.getItem("sphinx_highlight_terms")
|
|
||||||
|| url.searchParams.get("highlight")
|
|
||||||
|| "";
|
|
||||||
localStorage.removeItem("sphinx_highlight_terms")
|
|
||||||
url.searchParams.delete("highlight");
|
|
||||||
window.history.replaceState({}, "", url);
|
|
||||||
|
|
||||||
// get individual terms from highlight string
|
|
||||||
const terms = highlight.toLowerCase().split(/\s+/).filter(x => x);
|
|
||||||
if (terms.length === 0) return; // nothing to do
|
|
||||||
|
|
||||||
// There should never be more than one element matching "div.body"
|
|
||||||
const divBody = document.querySelectorAll("div.body");
|
|
||||||
const body = divBody.length ? divBody[0] : document.querySelector("body");
|
|
||||||
window.setTimeout(() => {
|
|
||||||
terms.forEach((term) => _highlightText(body, term, "highlighted"));
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
const searchBox = document.getElementById("searchbox");
|
|
||||||
if (searchBox === null) return;
|
|
||||||
searchBox.appendChild(
|
|
||||||
document
|
|
||||||
.createRange()
|
|
||||||
.createContextualFragment(
|
|
||||||
'<p class="highlight-link">' +
|
|
||||||
'<a href="javascript:SphinxHighlight.hideSearchWords()">' +
|
|
||||||
_("Hide Search Matches") +
|
|
||||||
"</a></p>"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper function to hide the search marks again
|
|
||||||
*/
|
|
||||||
hideSearchWords: () => {
|
|
||||||
document
|
|
||||||
.querySelectorAll("#searchbox .highlight-link")
|
|
||||||
.forEach((el) => el.remove());
|
|
||||||
document
|
|
||||||
.querySelectorAll("span.highlighted")
|
|
||||||
.forEach((el) => el.classList.remove("highlighted"));
|
|
||||||
localStorage.removeItem("sphinx_highlight_terms")
|
|
||||||
},
|
|
||||||
|
|
||||||
initEscapeListener: () => {
|
|
||||||
// only install a listener if it is really needed
|
|
||||||
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return;
|
|
||||||
|
|
||||||
document.addEventListener("keydown", (event) => {
|
|
||||||
// bail for input elements
|
|
||||||
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
|
|
||||||
// bail with special keys
|
|
||||||
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
||||||
if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) {
|
|
||||||
SphinxHighlight.hideSearchWords();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
_ready(() => {
|
|
||||||
/* Do not call highlightSearchWords() when we are on the search page.
|
|
||||||
* It will highlight words from the *previous* search query.
|
|
||||||
*/
|
|
||||||
if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords();
|
|
||||||
SphinxHighlight.initEscapeListener();
|
|
||||||
});
|
|
@ -1,24 +0,0 @@
|
|||||||
const pydocthemeDark = document.getElementById('pydoctheme_dark_css')
|
|
||||||
const pygmentsDark = document.getElementById('pygments_dark_css')
|
|
||||||
const themeSelectors = document.getElementsByClassName('theme-selector')
|
|
||||||
|
|
||||||
function activateTheme(theme) {
|
|
||||||
localStorage.setItem('currentTheme', theme);
|
|
||||||
[...themeSelectors].forEach(e => e.value = theme)
|
|
||||||
switch (theme) {
|
|
||||||
case 'light':
|
|
||||||
pydocthemeDark.media = 'not all'
|
|
||||||
pygmentsDark.media = 'not all'
|
|
||||||
break;
|
|
||||||
case 'dark':
|
|
||||||
pydocthemeDark.media = 'all'
|
|
||||||
pygmentsDark.media = 'all'
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// auto
|
|
||||||
pydocthemeDark.media = '(prefers-color-scheme: dark)'
|
|
||||||
pygmentsDark.media = '(prefers-color-scheme: dark)'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
activateTheme(localStorage.getItem('currentTheme') || 'auto')
|
|
353
Dependencies/Python/Doc/html/about.html
vendored
@ -1,353 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="About this documentation" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/about.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:description" content="Python’s documentation is generated from reStructuredText sources using Sphinx, a documentation generator originally created for Python and now maintained as an independent project. Development of ..." />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta name="description" content="Python’s documentation is generated from reStructuredText sources using Sphinx, a documentation generator originally created for Python and now maintained as an independent project. Development of ..." />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>About this documentation — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="#" />
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="copyright.html" />
|
|
||||||
<link rel="next" title="Dealing with Bugs" href="bugs.html" />
|
|
||||||
<link rel="prev" title="Glossary" href="glossary.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/about.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h3><a href="contents.html">Table of Contents</a></h3>
|
|
||||||
<ul>
|
|
||||||
<li><a class="reference internal" href="#">About this documentation</a><ul>
|
|
||||||
<li><a class="reference internal" href="#contributors-to-the-python-documentation">Contributors to the Python documentation</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="glossary.html"
|
|
||||||
title="previous chapter">Glossary</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="bugs.html"
|
|
||||||
title="next chapter">Dealing with Bugs</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/about.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="bugs.html" title="Dealing with Bugs"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="glossary.html" title="Glossary"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-this"><a href="">About this documentation</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="about-this-documentation">
|
|
||||||
<h1>About this documentation<a class="headerlink" href="#about-this-documentation" title="Link to this heading">¶</a></h1>
|
|
||||||
<p>Python’s documentation is generated from <a class="reference external" href="https://docutils.sourceforge.io/rst.html">reStructuredText</a> sources
|
|
||||||
using <a class="reference external" href="https://www.sphinx-doc.org/">Sphinx</a>, a documentation generator originally created for Python
|
|
||||||
and now maintained as an independent project.</p>
|
|
||||||
<p>Development of the documentation and its toolchain is an entirely volunteer
|
|
||||||
effort, just like Python itself. If you want to contribute, please take a
|
|
||||||
look at the <a class="reference internal" href="bugs.html#reporting-bugs"><span class="std std-ref">Dealing with Bugs</span></a> page for information on how to do so. New
|
|
||||||
volunteers are always welcome!</p>
|
|
||||||
<p>Many thanks go to:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>Fred L. Drake, Jr., the creator of the original Python documentation toolset
|
|
||||||
and author of much of the content;</p></li>
|
|
||||||
<li><p>the <a class="reference external" href="https://docutils.sourceforge.io/">Docutils</a> project for creating
|
|
||||||
reStructuredText and the Docutils suite;</p></li>
|
|
||||||
<li><p>Fredrik Lundh for his Alternative Python Reference project from which Sphinx
|
|
||||||
got many good ideas.</p></li>
|
|
||||||
</ul>
|
|
||||||
<section id="contributors-to-the-python-documentation">
|
|
||||||
<h2>Contributors to the Python documentation<a class="headerlink" href="#contributors-to-the-python-documentation" title="Link to this heading">¶</a></h2>
|
|
||||||
<p>Many people have contributed to the Python language, the Python standard
|
|
||||||
library, and the Python documentation. See <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/Misc/ACKS">Misc/ACKS</a> in the Python
|
|
||||||
source distribution for a partial list of contributors.</p>
|
|
||||||
<p>It is only with the input and contributions of the Python community
|
|
||||||
that Python has such wonderful documentation – Thank You!</p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h3><a href="contents.html">Table of Contents</a></h3>
|
|
||||||
<ul>
|
|
||||||
<li><a class="reference internal" href="#">About this documentation</a><ul>
|
|
||||||
<li><a class="reference internal" href="#contributors-to-the-python-documentation">Contributors to the Python documentation</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="glossary.html"
|
|
||||||
title="previous chapter">Glossary</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="bugs.html"
|
|
||||||
title="next chapter">Dealing with Bugs</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/about.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="bugs.html" title="Dealing with Bugs"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="glossary.html" title="Glossary"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-this"><a href="">About this documentation</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
415
Dependencies/Python/Doc/html/bugs.html
vendored
@ -1,415 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="./">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="Dealing with Bugs" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/bugs.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:description" content="Python is a mature programming language which has established a reputation for stability. In order to maintain this reputation, the developers would like to know of any deficiencies you find in Pyt..." />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta name="description" content="Python is a mature programming language which has established a reputation for stability. In order to maintain this reputation, the developers would like to know of any deficiencies you find in Pyt..." />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>Dealing with Bugs — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="about.html" />
|
|
||||||
<link rel="index" title="Index" href="genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="copyright.html" />
|
|
||||||
<link rel="next" title="Copyright" href="copyright.html" />
|
|
||||||
<link rel="prev" title="About this documentation" href="about.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/bugs.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h3><a href="contents.html">Table of Contents</a></h3>
|
|
||||||
<ul>
|
|
||||||
<li><a class="reference internal" href="#">Dealing with Bugs</a><ul>
|
|
||||||
<li><a class="reference internal" href="#documentation-bugs">Documentation bugs</a></li>
|
|
||||||
<li><a class="reference internal" href="#using-the-python-issue-tracker">Using the Python issue tracker</a></li>
|
|
||||||
<li><a class="reference internal" href="#getting-started-contributing-to-python-yourself">Getting started contributing to Python yourself</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="about.html"
|
|
||||||
title="previous chapter">About this documentation</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="copyright.html"
|
|
||||||
title="next chapter">Copyright</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="#">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/bugs.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="copyright.html" title="Copyright"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="about.html" title="About this documentation"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Dealing with Bugs</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="dealing-with-bugs">
|
|
||||||
<span id="reporting-bugs"></span><h1>Dealing with Bugs<a class="headerlink" href="#dealing-with-bugs" title="Link to this heading">¶</a></h1>
|
|
||||||
<p>Python is a mature programming language which has established a reputation for
|
|
||||||
stability. In order to maintain this reputation, the developers would like to
|
|
||||||
know of any deficiencies you find in Python.</p>
|
|
||||||
<p>It can be sometimes faster to fix bugs yourself and contribute patches to
|
|
||||||
Python as it streamlines the process and involves less people. Learn how to
|
|
||||||
<a class="reference internal" href="#contributing-to-python"><span class="std std-ref">contribute</span></a>.</p>
|
|
||||||
<section id="documentation-bugs">
|
|
||||||
<h2>Documentation bugs<a class="headerlink" href="#documentation-bugs" title="Link to this heading">¶</a></h2>
|
|
||||||
<p>If you find a bug in this documentation or would like to propose an improvement,
|
|
||||||
please submit a bug report on the <a class="reference internal" href="#using-the-tracker"><span class="std std-ref">tracker</span></a>. If you
|
|
||||||
have a suggestion on how to fix it, include that as well.</p>
|
|
||||||
<p>You can also open a discussion item on our
|
|
||||||
<a class="reference external" href="https://discuss.python.org/c/documentation/26">Documentation Discourse forum</a>.</p>
|
|
||||||
<p>If you find a bug in the theme (HTML / CSS / JavaScript) of the
|
|
||||||
documentation, please submit a bug report on the <a class="reference external" href="https://github.com/python/python-docs-theme">python-doc-theme bug
|
|
||||||
tracker</a>.</p>
|
|
||||||
<p>If you’re short on time, you can also email documentation bug reports to
|
|
||||||
<a class="reference external" href="mailto:docs%40python.org">docs<span>@</span>python<span>.</span>org</a> (behavioral bugs can be sent to <a class="reference external" href="mailto:python-list%40python.org">python-list<span>@</span>python<span>.</span>org</a>).
|
|
||||||
‘docs@’ is a mailing list run by volunteers; your request will be noticed,
|
|
||||||
though it may take a while to be processed.</p>
|
|
||||||
<div class="admonition seealso">
|
|
||||||
<p class="admonition-title">See also</p>
|
|
||||||
<dl class="simple">
|
|
||||||
<dt><a class="reference external" href="https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Adocs">Documentation bugs</a></dt><dd><p>A list of documentation bugs that have been submitted to the Python issue tracker.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="reference external" href="https://devguide.python.org/tracker/">Issue Tracking</a></dt><dd><p>Overview of the process involved in reporting an improvement on the tracker.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="reference external" href="https://devguide.python.org/docquality/#helping-with-documentation">Helping with Documentation</a></dt><dd><p>Comprehensive guide for individuals that are interested in contributing to Python documentation.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="reference external" href="https://devguide.python.org/documentation/translating/">Documentation Translations</a></dt><dd><p>A list of GitHub pages for documentation translation and their primary contacts.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="using-the-python-issue-tracker">
|
|
||||||
<span id="using-the-tracker"></span><h2>Using the Python issue tracker<a class="headerlink" href="#using-the-python-issue-tracker" title="Link to this heading">¶</a></h2>
|
|
||||||
<p>Issue reports for Python itself should be submitted via the GitHub issues
|
|
||||||
tracker (<a class="reference external" href="https://github.com/python/cpython/issues">https://github.com/python/cpython/issues</a>).
|
|
||||||
The GitHub issues tracker offers a web form which allows pertinent information
|
|
||||||
to be entered and submitted to the developers.</p>
|
|
||||||
<p>The first step in filing a report is to determine whether the problem has
|
|
||||||
already been reported. The advantage in doing so, aside from saving the
|
|
||||||
developers’ time, is that you learn what has been done to fix it; it may be that
|
|
||||||
the problem has already been fixed for the next release, or additional
|
|
||||||
information is needed (in which case you are welcome to provide it if you can!).
|
|
||||||
To do this, search the tracker using the search box at the top of the page.</p>
|
|
||||||
<p>If the problem you’re reporting is not already in the list, log in to GitHub.
|
|
||||||
If you don’t already have a GitHub account, create a new account using the
|
|
||||||
“Sign up” link.
|
|
||||||
It is not possible to submit a bug report anonymously.</p>
|
|
||||||
<p>Being now logged in, you can submit an issue.
|
|
||||||
Click on the “New issue” button in the top bar to report a new issue.</p>
|
|
||||||
<p>The submission form has two fields, “Title” and “Comment”.</p>
|
|
||||||
<p>For the “Title” field, enter a <em>very</em> short description of the problem;
|
|
||||||
fewer than ten words is good.</p>
|
|
||||||
<p>In the “Comment” field, describe the problem in detail, including what you
|
|
||||||
expected to happen and what did happen. Be sure to include whether any
|
|
||||||
extension modules were involved, and what hardware and software platform you
|
|
||||||
were using (including version information as appropriate).</p>
|
|
||||||
<p>Each issue report will be reviewed by a developer who will determine what needs to
|
|
||||||
be done to correct the problem. You will receive an update each time an action is
|
|
||||||
taken on the issue.</p>
|
|
||||||
<div class="admonition seealso">
|
|
||||||
<p class="admonition-title">See also</p>
|
|
||||||
<dl class="simple">
|
|
||||||
<dt><a class="reference external" href="https://www.chiark.greenend.org.uk/~sgtatham/bugs.html">How to Report Bugs Effectively</a></dt><dd><p>Article which goes into some detail about how to create a useful bug report.
|
|
||||||
This describes what kind of information is useful and why it is useful.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><a class="reference external" href="https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html">Bug Writing Guidelines</a></dt><dd><p>Information about writing a good bug report. Some of this is specific to the
|
|
||||||
Mozilla project, but describes general good practices.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="getting-started-contributing-to-python-yourself">
|
|
||||||
<span id="contributing-to-python"></span><h2>Getting started contributing to Python yourself<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="Link to this heading">¶</a></h2>
|
|
||||||
<p>Beyond just reporting bugs that you find, you are also welcome to submit
|
|
||||||
patches to fix them. You can find more information on how to get started
|
|
||||||
patching Python in the <a class="reference external" href="https://devguide.python.org/">Python Developer’s Guide</a>. If you have questions,
|
|
||||||
the <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">core-mentorship mailing list</a> is a friendly place to get answers to
|
|
||||||
any and all questions pertaining to the process of fixing issues in Python.</p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h3><a href="contents.html">Table of Contents</a></h3>
|
|
||||||
<ul>
|
|
||||||
<li><a class="reference internal" href="#">Dealing with Bugs</a><ul>
|
|
||||||
<li><a class="reference internal" href="#documentation-bugs">Documentation bugs</a></li>
|
|
||||||
<li><a class="reference internal" href="#using-the-python-issue-tracker">Using the Python issue tracker</a></li>
|
|
||||||
<li><a class="reference internal" href="#getting-started-contributing-to-python-yourself">Getting started contributing to Python yourself</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="about.html"
|
|
||||||
title="previous chapter">About this documentation</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="copyright.html"
|
|
||||||
title="next chapter">Copyright</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="#">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/bugs.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="copyright.html" title="Copyright"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="about.html" title="About this documentation"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Dealing with Bugs</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
356
Dependencies/Python/Doc/html/c-api/abstract.html
vendored
@ -1,356 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="../">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="Abstract Objects Layer" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/c-api/abstract.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:description" content="The functions in this chapter interact with Python objects regardless of their type, or with wide classes of object types (e.g. all numerical types, or all sequence types). When used on object type..." />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta name="description" content="The functions in this chapter interact with Python objects regardless of their type, or with wide classes of object types (e.g. all numerical types, or all sequence types). When used on object type..." />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>Abstract Objects Layer — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="../_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="../_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="../about.html" />
|
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
||||||
<link rel="next" title="Object Protocol" href="object.html" />
|
|
||||||
<link rel="prev" title="Support for Perf Maps" href="perfmaps.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/c-api/abstract.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="../_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="../search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="perfmaps.html"
|
|
||||||
title="previous chapter">Support for Perf Maps</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="object.html"
|
|
||||||
title="next chapter">Object Protocol</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/abstract.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="object.html" title="Object Protocol"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="perfmaps.html" title="Support for Perf Maps"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Abstract Objects Layer</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="abstract-objects-layer">
|
|
||||||
<span id="abstract"></span><h1>Abstract Objects Layer<a class="headerlink" href="#abstract-objects-layer" title="Link to this heading">¶</a></h1>
|
|
||||||
<p>The functions in this chapter interact with Python objects regardless of their
|
|
||||||
type, or with wide classes of object types (e.g. all numerical types, or all
|
|
||||||
sequence types). When used on object types for which they do not apply, they
|
|
||||||
will raise a Python exception.</p>
|
|
||||||
<p>It is not possible to use these functions on objects that are not properly
|
|
||||||
initialized, such as a list object that has been created by <a class="reference internal" href="list.html#c.PyList_New" title="PyList_New"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyList_New()</span></code></a>,
|
|
||||||
but whose items have not been set to some non-<code class="docutils literal notranslate"><span class="pre">NULL</span></code> value yet.</p>
|
|
||||||
<div class="toctree-wrapper compound">
|
|
||||||
<ul>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="object.html">Object Protocol</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="call.html">Call Protocol</a><ul>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="call.html#the-tp-call-protocol">The <em>tp_call</em> Protocol</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="call.html#the-vectorcall-protocol">The Vectorcall Protocol</a><ul>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="call.html#recursion-control">Recursion Control</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="call.html#vectorcall-support-api">Vectorcall Support API</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="call.html#object-calling-api">Object Calling API</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="call.html#call-support-api">Call Support API</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="number.html">Number Protocol</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="sequence.html">Sequence Protocol</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="mapping.html">Mapping Protocol</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="iter.html">Iterator Protocol</a></li>
|
|
||||||
<li class="toctree-l1"><a class="reference internal" href="buffer.html">Buffer Protocol</a><ul>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="buffer.html#buffer-structure">Buffer structure</a></li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="buffer.html#buffer-request-types">Buffer request types</a><ul>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#request-independent-fields">request-independent fields</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#readonly-format">readonly, format</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#shape-strides-suboffsets">shape, strides, suboffsets</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#contiguity-requests">contiguity requests</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#compound-requests">compound requests</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="buffer.html#complex-arrays">Complex arrays</a><ul>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#numpy-style-shape-and-strides">NumPy-style: shape and strides</a></li>
|
|
||||||
<li class="toctree-l3"><a class="reference internal" href="buffer.html#pil-style-shape-strides-and-suboffsets">PIL-style: shape, strides and suboffsets</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="toctree-l2"><a class="reference internal" href="buffer.html#buffer-related-functions">Buffer-related functions</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="perfmaps.html"
|
|
||||||
title="previous chapter">Support for Perf Maps</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="object.html"
|
|
||||||
title="next chapter">Object Protocol</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/abstract.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="object.html" title="Object Protocol"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="perfmaps.html" title="Support for Perf Maps"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Abstract Objects Layer</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="../copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
394
Dependencies/Python/Doc/html/c-api/allocation.html
vendored
@ -1,394 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="../">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="Allocating Objects on the Heap" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/c-api/allocation.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>Allocating Objects on the Heap — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="../_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="../_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="../about.html" />
|
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
||||||
<link rel="next" title="Common Object Structures" href="structures.html" />
|
|
||||||
<link rel="prev" title="Object Implementation Support" href="objimpl.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/c-api/allocation.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="../_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="../search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="objimpl.html"
|
|
||||||
title="previous chapter">Object Implementation Support</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="structures.html"
|
|
||||||
title="next chapter">Common Object Structures</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/allocation.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="structures.html" title="Common Object Structures"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="objimpl.html" title="Object Implementation Support"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-2"><a href="objimpl.html" accesskey="U">Object Implementation Support</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Allocating Objects on the Heap</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="allocating-objects-on-the-heap">
|
|
||||||
<span id="allocating-objects"></span><h1>Allocating Objects on the Heap<a class="headerlink" href="#allocating-objects-on-the-heap" title="Link to this heading">¶</a></h1>
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c._PyObject_New">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">_PyObject_New</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><span class="n"><span class="pre">PyTypeObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">type</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c._PyObject_New" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_new_ref">Return value: New reference.</em></dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c._PyObject_NewVar">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyVarObject" title="PyVarObject"><span class="n"><span class="pre">PyVarObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">_PyObject_NewVar</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><span class="n"><span class="pre">PyTypeObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">type</span></span>, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="n"><span class="pre">size</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c._PyObject_NewVar" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_new_ref">Return value: New reference.</em></dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyObject_Init">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyObject_Init</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">op</span></span>, <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><span class="n"><span class="pre">PyTypeObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">type</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyObject_Init" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_borrowed_ref">Return value: Borrowed reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Initialize a newly allocated object <em>op</em> with its type and initial
|
|
||||||
reference. Returns the initialized object. Other fields of the object are
|
|
||||||
not affected.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyObject_InitVar">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyVarObject" title="PyVarObject"><span class="n"><span class="pre">PyVarObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyObject_InitVar</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyVarObject" title="PyVarObject"><span class="n"><span class="pre">PyVarObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">op</span></span>, <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><span class="n"><span class="pre">PyTypeObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">type</span></span>, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="n"><span class="pre">size</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyObject_InitVar" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_borrowed_ref">Return value: Borrowed reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>This does everything <a class="reference internal" href="#c.PyObject_Init" title="PyObject_Init"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyObject_Init()</span></code></a> does, and also initializes the
|
|
||||||
length information for a variable-size object.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PyObject_New">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PyObject_New</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">TYPE</span></span>, <span class="n"><span class="pre">typeobj</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyObject_New" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Allocate a new Python object using the C structure type <em>TYPE</em>
|
|
||||||
and the Python type object <em>typeobj</em> (<code class="docutils literal notranslate"><span class="pre">PyTypeObject*</span></code>).
|
|
||||||
Fields not defined by the Python object header are not initialized.
|
|
||||||
The caller will own the only reference to the object
|
|
||||||
(i.e. its reference count will be one).
|
|
||||||
The size of the memory allocation is determined from the
|
|
||||||
<a class="reference internal" href="typeobj.html#c.PyTypeObject.tp_basicsize" title="PyTypeObject.tp_basicsize"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_basicsize</span></code></a> field of the type object.</p>
|
|
||||||
<p>Note that this function is unsuitable if <em>typeobj</em> has
|
|
||||||
<a class="reference internal" href="typeobj.html#c.Py_TPFLAGS_HAVE_GC" title="Py_TPFLAGS_HAVE_GC"><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_TPFLAGS_HAVE_GC</span></code></a> set. For such objects,
|
|
||||||
use <a class="reference internal" href="gcsupport.html#c.PyObject_GC_New" title="PyObject_GC_New"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyObject_GC_New()</span></code></a> instead.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PyObject_NewVar">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PyObject_NewVar</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">TYPE</span></span>, <span class="n"><span class="pre">typeobj</span></span>, <span class="n"><span class="pre">size</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyObject_NewVar" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Allocate a new Python object using the C structure type <em>TYPE</em> and the
|
|
||||||
Python type object <em>typeobj</em> (<code class="docutils literal notranslate"><span class="pre">PyTypeObject*</span></code>).
|
|
||||||
Fields not defined by the Python object header
|
|
||||||
are not initialized. The allocated memory allows for the <em>TYPE</em> structure
|
|
||||||
plus <em>size</em> (<code class="docutils literal notranslate"><span class="pre">Py_ssize_t</span></code>) fields of the size
|
|
||||||
given by the <a class="reference internal" href="typeobj.html#c.PyTypeObject.tp_itemsize" title="PyTypeObject.tp_itemsize"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_itemsize</span></code></a> field of
|
|
||||||
<em>typeobj</em>. This is useful for implementing objects like tuples, which are
|
|
||||||
able to determine their size at construction time. Embedding the array of
|
|
||||||
fields into the same allocation decreases the number of allocations,
|
|
||||||
improving the memory management efficiency.</p>
|
|
||||||
<p>Note that this function is unsuitable if <em>typeobj</em> has
|
|
||||||
<a class="reference internal" href="typeobj.html#c.Py_TPFLAGS_HAVE_GC" title="Py_TPFLAGS_HAVE_GC"><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_TPFLAGS_HAVE_GC</span></code></a> set. For such objects,
|
|
||||||
use <a class="reference internal" href="gcsupport.html#c.PyObject_GC_NewVar" title="PyObject_GC_NewVar"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyObject_GC_NewVar()</span></code></a> instead.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyObject_Del">
|
|
||||||
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyObject_Del</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">op</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyObject_Del" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Releases memory allocated to an object using <a class="reference internal" href="#c.PyObject_New" title="PyObject_New"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PyObject_New</span></code></a> or
|
|
||||||
<a class="reference internal" href="#c.PyObject_NewVar" title="PyObject_NewVar"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PyObject_NewVar</span></code></a>. This is normally called from the
|
|
||||||
<a class="reference internal" href="typeobj.html#c.PyTypeObject.tp_dealloc" title="PyTypeObject.tp_dealloc"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_dealloc</span></code></a> handler specified in the object’s type. The fields of
|
|
||||||
the object should not be accessed after this call as the memory is no
|
|
||||||
longer a valid Python object.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c var">
|
|
||||||
<dt class="sig sig-object c" id="c._Py_NoneStruct">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">_Py_NoneStruct</span></span></span><a class="headerlink" href="#c._Py_NoneStruct" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Object which is visible in Python as <code class="docutils literal notranslate"><span class="pre">None</span></code>. This should only be accessed
|
|
||||||
using the <a class="reference internal" href="none.html#c.Py_None" title="Py_None"><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_None</span></code></a> macro, which evaluates to a pointer to this
|
|
||||||
object.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<div class="admonition seealso">
|
|
||||||
<p class="admonition-title">See also</p>
|
|
||||||
<dl class="simple">
|
|
||||||
<dt><a class="reference internal" href="module.html#c.PyModule_Create" title="PyModule_Create"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyModule_Create()</span></code></a></dt><dd><p>To allocate and create extension modules.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="objimpl.html"
|
|
||||||
title="previous chapter">Object Implementation Support</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="structures.html"
|
|
||||||
title="next chapter">Common Object Structures</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/allocation.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="structures.html" title="Common Object Structures"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="objimpl.html" title="Object Implementation Support"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-2"><a href="objimpl.html" >Object Implementation Support</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Allocating Objects on the Heap</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="../copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,406 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="../">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="API and ABI Versioning" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/c-api/apiabiversion.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:description" content="CPython exposes its version number in the following macros. Note that these correspond to the version code is built with, not necessarily the version used at run time. See C API Stability for a dis..." />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta name="description" content="CPython exposes its version number in the following macros. Note that these correspond to the version code is built with, not necessarily the version used at run time. See C API Stability for a dis..." />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>API and ABI Versioning — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="../_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="../_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="../about.html" />
|
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
||||||
<link rel="next" title="Monitoring C API" href="monitoring.html" />
|
|
||||||
<link rel="prev" title="Supporting Cyclic Garbage Collection" href="gcsupport.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/c-api/apiabiversion.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="../_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="../search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="gcsupport.html"
|
|
||||||
title="previous chapter">Supporting Cyclic Garbage Collection</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="monitoring.html"
|
|
||||||
title="next chapter">Monitoring C API</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/apiabiversion.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="monitoring.html" title="Monitoring C API"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="gcsupport.html" title="Supporting Cyclic Garbage Collection"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">API and ABI Versioning</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="api-and-abi-versioning">
|
|
||||||
<span id="apiabiversion"></span><h1>API and ABI Versioning<a class="headerlink" href="#api-and-abi-versioning" title="Link to this heading">¶</a></h1>
|
|
||||||
<p>CPython exposes its version number in the following macros.
|
|
||||||
Note that these correspond to the version code is <strong>built</strong> with,
|
|
||||||
not necessarily the version used at <strong>run time</strong>.</p>
|
|
||||||
<p>See <a class="reference internal" href="stable.html#stable"><span class="std std-ref">C API Stability</span></a> for a discussion of API and ABI stability across versions.</p>
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_MAJOR_VERSION">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_MAJOR_VERSION</span></span></span><a class="headerlink" href="#c.PY_MAJOR_VERSION" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The <code class="docutils literal notranslate"><span class="pre">3</span></code> in <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code>.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_MINOR_VERSION">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_MINOR_VERSION</span></span></span><a class="headerlink" href="#c.PY_MINOR_VERSION" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The <code class="docutils literal notranslate"><span class="pre">4</span></code> in <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code>.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_MICRO_VERSION">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_MICRO_VERSION</span></span></span><a class="headerlink" href="#c.PY_MICRO_VERSION" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The <code class="docutils literal notranslate"><span class="pre">1</span></code> in <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code>.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_RELEASE_LEVEL">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_RELEASE_LEVEL</span></span></span><a class="headerlink" href="#c.PY_RELEASE_LEVEL" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The <code class="docutils literal notranslate"><span class="pre">a</span></code> in <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code>.
|
|
||||||
This can be <code class="docutils literal notranslate"><span class="pre">0xA</span></code> for alpha, <code class="docutils literal notranslate"><span class="pre">0xB</span></code> for beta, <code class="docutils literal notranslate"><span class="pre">0xC</span></code> for release
|
|
||||||
candidate or <code class="docutils literal notranslate"><span class="pre">0xF</span></code> for final.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_RELEASE_SERIAL">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_RELEASE_SERIAL</span></span></span><a class="headerlink" href="#c.PY_RELEASE_SERIAL" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The <code class="docutils literal notranslate"><span class="pre">2</span></code> in <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code>. Zero for final releases.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_VERSION_HEX">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_VERSION_HEX</span></span></span><a class="headerlink" href="#c.PY_VERSION_HEX" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The Python version number encoded in a single integer.</p>
|
|
||||||
<p>The underlying version information can be found by treating it as a 32 bit
|
|
||||||
number in the following manner:</p>
|
|
||||||
<table class="docutils align-default">
|
|
||||||
<thead>
|
|
||||||
<tr class="row-odd"><th class="head"><p>Bytes</p></th>
|
|
||||||
<th class="head"><p>Bits (big endian order)</p></th>
|
|
||||||
<th class="head"><p>Meaning</p></th>
|
|
||||||
<th class="head"><p>Value for <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code></p></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="row-even"><td><p>1</p></td>
|
|
||||||
<td><p>1-8</p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">PY_MAJOR_VERSION</span></code></p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">0x03</span></code></p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-odd"><td><p>2</p></td>
|
|
||||||
<td><p>9-16</p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">PY_MINOR_VERSION</span></code></p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">0x04</span></code></p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-even"><td><p>3</p></td>
|
|
||||||
<td><p>17-24</p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">PY_MICRO_VERSION</span></code></p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">0x01</span></code></p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-odd"><td rowspan="2"><p>4</p></td>
|
|
||||||
<td><p>25-28</p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">PY_RELEASE_LEVEL</span></code></p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">0xA</span></code></p></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="row-even"><td><p>29-32</p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">PY_RELEASE_SERIAL</span></code></p></td>
|
|
||||||
<td><p><code class="docutils literal notranslate"><span class="pre">0x2</span></code></p></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p>Thus <code class="docutils literal notranslate"><span class="pre">3.4.1a2</span></code> is hexversion <code class="docutils literal notranslate"><span class="pre">0x030401a2</span></code> and <code class="docutils literal notranslate"><span class="pre">3.10.0</span></code> is
|
|
||||||
hexversion <code class="docutils literal notranslate"><span class="pre">0x030a00f0</span></code>.</p>
|
|
||||||
<p>Use this for numeric comparisons, e.g. <code class="docutils literal notranslate"><span class="pre">#if</span> <span class="pre">PY_VERSION_HEX</span> <span class="pre">>=</span> <span class="pre">...</span></code>.</p>
|
|
||||||
<p>This version is also available via the symbol <a class="reference internal" href="#c.Py_Version" title="Py_Version"><code class="xref c c-var docutils literal notranslate"><span class="pre">Py_Version</span></code></a>.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c var">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_Version">
|
|
||||||
<span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">Py_Version</span></span></span><a class="headerlink" href="#c.Py_Version" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a> since version 3.11.</em><p>The Python runtime version number encoded in a single constant integer, with
|
|
||||||
the same format as the <a class="reference internal" href="#c.PY_VERSION_HEX" title="PY_VERSION_HEX"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PY_VERSION_HEX</span></code></a> macro.
|
|
||||||
This contains the Python version used at run time.</p>
|
|
||||||
<div class="versionadded">
|
|
||||||
<p><span class="versionmodified added">Added in version 3.11.</span></p>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<p>All the given macros are defined in <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.13/Include/patchlevel.h">Include/patchlevel.h</a>.</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="gcsupport.html"
|
|
||||||
title="previous chapter">Supporting Cyclic Garbage Collection</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="monitoring.html"
|
|
||||||
title="next chapter">Monitoring C API</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/apiabiversion.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="monitoring.html" title="Monitoring C API"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="gcsupport.html" title="Supporting Cyclic Garbage Collection"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">API and ABI Versioning</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="../copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
959
Dependencies/Python/Doc/html/c-api/arg.html
vendored
@ -1,959 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="../">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="Parsing arguments and building values" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/c-api/arg.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:description" content="These functions are useful when creating your own extension functions and methods. Additional information and examples are available in Extending and Embedding the Python Interpreter. The first thr..." />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta name="description" content="These functions are useful when creating your own extension functions and methods. Additional information and examples are available in Extending and Embedding the Python Interpreter. The first thr..." />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>Parsing arguments and building values — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="../_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="../_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="../about.html" />
|
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
||||||
<link rel="next" title="String conversion and formatting" href="conversion.html" />
|
|
||||||
<link rel="prev" title="Data marshalling support" href="marshal.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/c-api/arg.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="../_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="../search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h3><a href="../contents.html">Table of Contents</a></h3>
|
|
||||||
<ul>
|
|
||||||
<li><a class="reference internal" href="#">Parsing arguments and building values</a><ul>
|
|
||||||
<li><a class="reference internal" href="#parsing-arguments">Parsing arguments</a><ul>
|
|
||||||
<li><a class="reference internal" href="#strings-and-buffers">Strings and buffers</a></li>
|
|
||||||
<li><a class="reference internal" href="#numbers">Numbers</a></li>
|
|
||||||
<li><a class="reference internal" href="#other-objects">Other objects</a></li>
|
|
||||||
<li><a class="reference internal" href="#api-functions">API Functions</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a class="reference internal" href="#building-values">Building values</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="marshal.html"
|
|
||||||
title="previous chapter">Data marshalling support</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="conversion.html"
|
|
||||||
title="next chapter">String conversion and formatting</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/arg.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="conversion.html" title="String conversion and formatting"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="marshal.html" title="Data marshalling support"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-2"><a href="utilities.html" accesskey="U">Utilities</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Parsing arguments and building values</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="parsing-arguments-and-building-values">
|
|
||||||
<span id="arg-parsing"></span><h1>Parsing arguments and building values<a class="headerlink" href="#parsing-arguments-and-building-values" title="Link to this heading">¶</a></h1>
|
|
||||||
<p>These functions are useful when creating your own extension functions and
|
|
||||||
methods. Additional information and examples are available in
|
|
||||||
<a class="reference internal" href="../extending/index.html#extending-index"><span class="std std-ref">Extending and Embedding the Python Interpreter</span></a>.</p>
|
|
||||||
<p>The first three of these functions described, <a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a>,
|
|
||||||
<a class="reference internal" href="#c.PyArg_ParseTupleAndKeywords" title="PyArg_ParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTupleAndKeywords()</span></code></a>, and <a class="reference internal" href="#c.PyArg_Parse" title="PyArg_Parse"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_Parse()</span></code></a>, all use <em>format
|
|
||||||
strings</em> which are used to tell the function about the expected arguments. The
|
|
||||||
format strings use the same syntax for each of these functions.</p>
|
|
||||||
<section id="parsing-arguments">
|
|
||||||
<h2>Parsing arguments<a class="headerlink" href="#parsing-arguments" title="Link to this heading">¶</a></h2>
|
|
||||||
<p>A format string consists of zero or more “format units.” A format unit
|
|
||||||
describes one Python object; it is usually a single character or a parenthesized
|
|
||||||
sequence of format units. With a few exceptions, a format unit that is not a
|
|
||||||
parenthesized sequence normally corresponds to a single address argument to
|
|
||||||
these functions. In the following description, the quoted form is the format
|
|
||||||
unit; the entry in (round) parentheses is the Python object type that matches
|
|
||||||
the format unit; and the entry in [square] brackets is the type of the C
|
|
||||||
variable(s) whose address should be passed.</p>
|
|
||||||
<section id="strings-and-buffers">
|
|
||||||
<span id="arg-parsing-string-and-buffers"></span><h3>Strings and buffers<a class="headerlink" href="#strings-and-buffers" title="Link to this heading">¶</a></h3>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>On Python 3.12 and older, the macro <code class="xref c c-macro docutils literal notranslate"><span class="pre">PY_SSIZE_T_CLEAN</span></code> must be
|
|
||||||
defined before including <code class="file docutils literal notranslate"><span class="pre">Python.h</span></code> to use all <code class="docutils literal notranslate"><span class="pre">#</span></code> variants of
|
|
||||||
formats (<code class="docutils literal notranslate"><span class="pre">s#</span></code>, <code class="docutils literal notranslate"><span class="pre">y#</span></code>, etc.) explained below.
|
|
||||||
This is not necessary on Python 3.13 and later.</p>
|
|
||||||
</div>
|
|
||||||
<p>These formats allow accessing an object as a contiguous chunk of memory.
|
|
||||||
You don’t have to provide raw storage for the returned unicode or bytes
|
|
||||||
area.</p>
|
|
||||||
<p>Unless otherwise stated, buffers are not NUL-terminated.</p>
|
|
||||||
<p>There are three ways strings and buffers can be converted to C:</p>
|
|
||||||
<ul>
|
|
||||||
<li><p>Formats such as <code class="docutils literal notranslate"><span class="pre">y*</span></code> and <code class="docutils literal notranslate"><span class="pre">s*</span></code> fill a <a class="reference internal" href="buffer.html#c.Py_buffer" title="Py_buffer"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_buffer</span></code></a> structure.
|
|
||||||
This locks the underlying buffer so that the caller can subsequently use
|
|
||||||
the buffer even inside a <a class="reference internal" href="init.html#c.Py_BEGIN_ALLOW_THREADS" title="Py_BEGIN_ALLOW_THREADS"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_BEGIN_ALLOW_THREADS</span></code></a>
|
|
||||||
block without the risk of mutable data being resized or destroyed.
|
|
||||||
As a result, <strong>you have to call</strong> <a class="reference internal" href="buffer.html#c.PyBuffer_Release" title="PyBuffer_Release"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyBuffer_Release()</span></code></a> after you have
|
|
||||||
finished processing the data (or in any early abort case).</p></li>
|
|
||||||
<li><p>The <code class="docutils literal notranslate"><span class="pre">es</span></code>, <code class="docutils literal notranslate"><span class="pre">es#</span></code>, <code class="docutils literal notranslate"><span class="pre">et</span></code> and <code class="docutils literal notranslate"><span class="pre">et#</span></code> formats allocate the result buffer.
|
|
||||||
<strong>You have to call</strong> <a class="reference internal" href="memory.html#c.PyMem_Free" title="PyMem_Free"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMem_Free()</span></code></a> after you have finished
|
|
||||||
processing the data (or in any early abort case).</p></li>
|
|
||||||
<li><p id="c-arg-borrowed-buffer">Other formats take a <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or a read-only <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>,
|
|
||||||
such as <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>, and provide a <code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*</span></code> pointer to
|
|
||||||
its buffer.
|
|
||||||
In this case the buffer is “borrowed”: it is managed by the corresponding
|
|
||||||
Python object, and shares the lifetime of this object.
|
|
||||||
You won’t have to release any memory yourself.</p>
|
|
||||||
<p>To ensure that the underlying buffer may be safely borrowed, the object’s
|
|
||||||
<a class="reference internal" href="typeobj.html#c.PyBufferProcs.bf_releasebuffer" title="PyBufferProcs.bf_releasebuffer"><code class="xref c c-member docutils literal notranslate"><span class="pre">PyBufferProcs.bf_releasebuffer</span></code></a> field must be <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.
|
|
||||||
This disallows common mutable objects such as <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a>,
|
|
||||||
but also some read-only objects such as <a class="reference internal" href="../library/stdtypes.html#memoryview" title="memoryview"><code class="xref py py-class docutils literal notranslate"><span class="pre">memoryview</span></code></a> of
|
|
||||||
<a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>.</p>
|
|
||||||
<p>Besides this <code class="docutils literal notranslate"><span class="pre">bf_releasebuffer</span></code> requirement, there is no check to verify
|
|
||||||
whether the input object is immutable (e.g. whether it would honor a request
|
|
||||||
for a writable buffer, or whether another thread can mutate the data).</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<dl>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">s</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) [const char *]</dt><dd><p>Convert a Unicode object to a C pointer to a character string.
|
|
||||||
A pointer to an existing string is stored in the character pointer
|
|
||||||
variable whose address you pass. The C string is NUL-terminated.
|
|
||||||
The Python string must not contain embedded null code points; if it does,
|
|
||||||
a <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> exception is raised. Unicode objects are converted
|
|
||||||
to C strings using <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code> encoding. If this conversion fails, a
|
|
||||||
<a class="reference internal" href="../library/exceptions.html#UnicodeError" title="UnicodeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UnicodeError</span></code></a> is raised.</p>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>This format does not accept <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like objects</span></a>. If you want to accept
|
|
||||||
filesystem paths and convert them to C character strings, it is
|
|
||||||
preferable to use the <code class="docutils literal notranslate"><span class="pre">O&</span></code> format with <a class="reference internal" href="unicode.html#c.PyUnicode_FSConverter" title="PyUnicode_FSConverter"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_FSConverter()</span></code></a>
|
|
||||||
as <em>converter</em>.</p>
|
|
||||||
</div>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.5: </span>Previously, <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> was raised when embedded null code points
|
|
||||||
were encountered in the Python string.</p>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">s*</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>) [Py_buffer]</dt><dd><p>This format accepts Unicode objects as well as bytes-like objects.
|
|
||||||
It fills a <a class="reference internal" href="buffer.html#c.Py_buffer" title="Py_buffer"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_buffer</span></code></a> structure provided by the caller.
|
|
||||||
In this case the resulting C string may contain embedded NUL bytes.
|
|
||||||
Unicode objects are converted to C strings using <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code> encoding.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">s#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, read-only <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Like <code class="docutils literal notranslate"><span class="pre">s*</span></code>, except that it provides a <a class="reference internal" href="#c-arg-borrowed-buffer"><span class="std std-ref">borrowed buffer</span></a>.
|
|
||||||
The result is stored into two C variables,
|
|
||||||
the first one a pointer to a C string, the second one its length.
|
|
||||||
The string may contain embedded null bytes. Unicode objects are converted
|
|
||||||
to C strings using <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code> encoding.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">z</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *]</dt><dd><p>Like <code class="docutils literal notranslate"><span class="pre">s</span></code>, but the Python object may also be <code class="docutils literal notranslate"><span class="pre">None</span></code>, in which case the C
|
|
||||||
pointer is set to <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">z*</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [Py_buffer]</dt><dd><p>Like <code class="docutils literal notranslate"><span class="pre">s*</span></code>, but the Python object may also be <code class="docutils literal notranslate"><span class="pre">None</span></code>, in which case the
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">buf</span></code> member of the <a class="reference internal" href="buffer.html#c.Py_buffer" title="Py_buffer"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_buffer</span></code></a> structure is set to <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">z#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, read-only <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Like <code class="docutils literal notranslate"><span class="pre">s#</span></code>, but the Python object may also be <code class="docutils literal notranslate"><span class="pre">None</span></code>, in which case the C
|
|
||||||
pointer is set to <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">y</span></code> (read-only <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>) [const char *]</dt><dd><p>This format converts a bytes-like object to a C pointer to a
|
|
||||||
<a class="reference internal" href="#c-arg-borrowed-buffer"><span class="std std-ref">borrowed</span></a> character string;
|
|
||||||
it does not accept Unicode objects. The bytes buffer must not
|
|
||||||
contain embedded null bytes; if it does, a <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a>
|
|
||||||
exception is raised.</p>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.5: </span>Previously, <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> was raised when embedded null bytes were
|
|
||||||
encountered in the bytes buffer.</p>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">y*</span></code> (<a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>) [Py_buffer]</dt><dd><p>This variant on <code class="docutils literal notranslate"><span class="pre">s*</span></code> doesn’t accept Unicode objects, only
|
|
||||||
bytes-like objects. <strong>This is the recommended way to accept
|
|
||||||
binary data.</strong></p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">y#</span></code> (read-only <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>This variant on <code class="docutils literal notranslate"><span class="pre">s#</span></code> doesn’t accept Unicode objects, only bytes-like
|
|
||||||
objects.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">S</span></code> (<a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>) [PyBytesObject *]</dt><dd><p>Requires that the Python object is a <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> object, without
|
|
||||||
attempting any conversion. Raises <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> if the object is not
|
|
||||||
a bytes object. The C variable may also be declared as <span class="c-expr sig sig-inline c"><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n">PyObject</span></a><span class="p">*</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">Y</span></code> (<a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a>) [PyByteArrayObject *]</dt><dd><p>Requires that the Python object is a <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> object, without
|
|
||||||
attempting any conversion. Raises <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> if the object is not
|
|
||||||
a <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> object. The C variable may also be declared as <span class="c-expr sig sig-inline c"><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n">PyObject</span></a><span class="p">*</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">U</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) [PyObject *]</dt><dd><p>Requires that the Python object is a Unicode object, without attempting
|
|
||||||
any conversion. Raises <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> if the object is not a Unicode
|
|
||||||
object. The C variable may also be declared as <span class="c-expr sig sig-inline c"><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n">PyObject</span></a><span class="p">*</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">w*</span></code> (read-write <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>) [Py_buffer]</dt><dd><p>This format accepts any object which implements the read-write buffer
|
|
||||||
interface. It fills a <a class="reference internal" href="buffer.html#c.Py_buffer" title="Py_buffer"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_buffer</span></code></a> structure provided by the caller.
|
|
||||||
The buffer may contain embedded null bytes. The caller have to call
|
|
||||||
<a class="reference internal" href="buffer.html#c.PyBuffer_Release" title="PyBuffer_Release"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyBuffer_Release()</span></code></a> when it is done with the buffer.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">es</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) [const char *encoding, char **buffer]</dt><dd><p>This variant on <code class="docutils literal notranslate"><span class="pre">s</span></code> is used for encoding Unicode into a character buffer.
|
|
||||||
It only works for encoded data without embedded NUL bytes.</p>
|
|
||||||
<p>This format requires two arguments. The first is only used as input, and
|
|
||||||
must be a <span class="c-expr sig sig-inline c"><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="p">*</span></span> which points to the name of an encoding as a
|
|
||||||
NUL-terminated string, or <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, in which case <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code> encoding is used.
|
|
||||||
An exception is raised if the named encoding is not known to Python. The
|
|
||||||
second argument must be a <span class="c-expr sig sig-inline c"><span class="kt">char</span><span class="p">*</span><span class="p">*</span></span>; the value of the pointer it
|
|
||||||
references will be set to a buffer with the contents of the argument text.
|
|
||||||
The text will be encoded in the encoding specified by the first argument.</p>
|
|
||||||
<p><a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> will allocate a buffer of the needed size, copy the
|
|
||||||
encoded data into this buffer and adjust <em>*buffer</em> to reference the newly
|
|
||||||
allocated storage. The caller is responsible for calling <a class="reference internal" href="memory.html#c.PyMem_Free" title="PyMem_Free"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMem_Free()</span></code></a> to
|
|
||||||
free the allocated buffer after use.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">et</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> or <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a>) [const char *encoding, char **buffer]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">es</span></code> except that byte string objects are passed through without
|
|
||||||
recoding them. Instead, the implementation assumes that the byte string object uses
|
|
||||||
the encoding passed in as parameter.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">es#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) [const char *encoding, char **buffer, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a> *buffer_length]</dt><dd><p>This variant on <code class="docutils literal notranslate"><span class="pre">s#</span></code> is used for encoding Unicode into a character buffer.
|
|
||||||
Unlike the <code class="docutils literal notranslate"><span class="pre">es</span></code> format, this variant allows input data which contains NUL
|
|
||||||
characters.</p>
|
|
||||||
<p>It requires three arguments. The first is only used as input, and must be a
|
|
||||||
<span class="c-expr sig sig-inline c"><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="p">*</span></span> which points to the name of an encoding as a
|
|
||||||
NUL-terminated string, or <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, in which case <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code> encoding is used.
|
|
||||||
An exception is raised if the named encoding is not known to Python. The
|
|
||||||
second argument must be a <span class="c-expr sig sig-inline c"><span class="kt">char</span><span class="p">*</span><span class="p">*</span></span>; the value of the pointer it
|
|
||||||
references will be set to a buffer with the contents of the argument text.
|
|
||||||
The text will be encoded in the encoding specified by the first argument.
|
|
||||||
The third argument must be a pointer to an integer; the referenced integer
|
|
||||||
will be set to the number of bytes in the output buffer.</p>
|
|
||||||
<p>There are two modes of operation:</p>
|
|
||||||
<p>If <em>*buffer</em> points a <code class="docutils literal notranslate"><span class="pre">NULL</span></code> pointer, the function will allocate a buffer of
|
|
||||||
the needed size, copy the encoded data into this buffer and set <em>*buffer</em> to
|
|
||||||
reference the newly allocated storage. The caller is responsible for calling
|
|
||||||
<a class="reference internal" href="memory.html#c.PyMem_Free" title="PyMem_Free"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyMem_Free()</span></code></a> to free the allocated buffer after usage.</p>
|
|
||||||
<p>If <em>*buffer</em> points to a non-<code class="docutils literal notranslate"><span class="pre">NULL</span></code> pointer (an already allocated buffer),
|
|
||||||
<a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> will use this location as the buffer and interpret the
|
|
||||||
initial value of <em>*buffer_length</em> as the buffer size. It will then copy the
|
|
||||||
encoded data into the buffer and NUL-terminate it. If the buffer is not large
|
|
||||||
enough, a <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> will be set.</p>
|
|
||||||
<p>In both cases, <em>*buffer_length</em> is set to the length of the encoded data
|
|
||||||
without the trailing NUL byte.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">et#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>, <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> or <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a>) [const char *encoding, char **buffer, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a> *buffer_length]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">es#</span></code> except that byte string objects are passed through without recoding
|
|
||||||
them. Instead, the implementation assumes that the byte string object uses the
|
|
||||||
encoding passed in as parameter.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.12: </span><code class="docutils literal notranslate"><span class="pre">u</span></code>, <code class="docutils literal notranslate"><span class="pre">u#</span></code>, <code class="docutils literal notranslate"><span class="pre">Z</span></code>, and <code class="docutils literal notranslate"><span class="pre">Z#</span></code> are removed because they used a legacy
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">Py_UNICODE*</span></code> representation.</p>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section id="numbers">
|
|
||||||
<h3>Numbers<a class="headerlink" href="#numbers" title="Link to this heading">¶</a></h3>
|
|
||||||
<p>These formats allow representing Python numbers or single characters as C numbers.
|
|
||||||
Formats that require <a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>, <a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a> or <a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a> can
|
|
||||||
also use the corresponding special methods <a class="reference internal" href="../reference/datamodel.html#object.__index__" title="object.__index__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__index__()</span></code></a>,
|
|
||||||
<a class="reference internal" href="../reference/datamodel.html#object.__float__" title="object.__float__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__float__()</span></code></a> or <a class="reference internal" href="../reference/datamodel.html#object.__complex__" title="object.__complex__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__complex__()</span></code></a> to convert
|
|
||||||
the Python object to the required type.</p>
|
|
||||||
<p>For signed integer formats, <a class="reference internal" href="../library/exceptions.html#OverflowError" title="OverflowError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OverflowError</span></code></a> is raised if the value
|
|
||||||
is out of range for the C type.
|
|
||||||
For unsigned integer formats, no range checking is done — the
|
|
||||||
most significant bits are silently truncated when the receiving field is too
|
|
||||||
small to receive the value.</p>
|
|
||||||
<dl>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">b</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned char]</dt><dd><p>Convert a nonnegative Python integer to an unsigned tiny integer, stored in a C
|
|
||||||
<span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">char</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">B</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned char]</dt><dd><p>Convert a Python integer to a tiny integer without overflow checking, stored in a C
|
|
||||||
<span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">char</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">h</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [short int]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">short</span><span class="w"> </span><span class="kt">int</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">H</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned short int]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">short</span><span class="w"> </span><span class="kt">int</span></span>, without overflow
|
|
||||||
checking.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">i</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [int]</dt><dd><p>Convert a Python integer to a plain C <span class="c-expr sig sig-inline c"><span class="kt">int</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">I</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned int]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span></span>, without overflow
|
|
||||||
checking.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">l</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [long int]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">long</span><span class="w"> </span><span class="kt">int</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">k</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned long]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">long</span></span> without
|
|
||||||
overflow checking.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">L</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [long long]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">long</span><span class="w"> </span><span class="kt">long</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">K</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned long long]</dt><dd><p>Convert a Python integer to a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">long</span><span class="w"> </span><span class="kt">long</span></span>
|
|
||||||
without overflow checking.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">n</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [<a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Convert a Python integer to a C <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">c</span></code> (<a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> or <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> of length 1) [char]</dt><dd><p>Convert a Python byte, represented as a <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> or
|
|
||||||
<a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> object of length 1, to a C <span class="c-expr sig sig-inline c"><span class="kt">char</span></span>.</p>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.3: </span>Allow <a class="reference internal" href="../library/stdtypes.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></a> objects.</p>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">C</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> of length 1) [int]</dt><dd><p>Convert a Python character, represented as a <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> object of
|
|
||||||
length 1, to a C <span class="c-expr sig sig-inline c"><span class="kt">int</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">f</span></code> (<a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) [float]</dt><dd><p>Convert a Python floating-point number to a C <span class="c-expr sig sig-inline c"><span class="kt">float</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">d</span></code> (<a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) [double]</dt><dd><p>Convert a Python floating-point number to a C <span class="c-expr sig sig-inline c"><span class="kt">double</span></span>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">D</span></code> (<a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a>) [Py_complex]</dt><dd><p>Convert a Python complex number to a C <a class="reference internal" href="complex.html#c.Py_complex" title="Py_complex"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_complex</span></code></a> structure.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</section>
|
|
||||||
<section id="other-objects">
|
|
||||||
<h3>Other objects<a class="headerlink" href="#other-objects" title="Link to this heading">¶</a></h3>
|
|
||||||
<dl class="simple">
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">O</span></code> (object) [PyObject *]</dt><dd><p>Store a Python object (without any conversion) in a C object pointer. The C
|
|
||||||
program thus receives the actual object that was passed. A new
|
|
||||||
<a class="reference internal" href="../glossary.html#term-strong-reference"><span class="xref std std-term">strong reference</span></a> to the object is not created
|
|
||||||
(i.e. its reference count is not increased).
|
|
||||||
The pointer stored is not <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">O!</span></code> (object) [<em>typeobject</em>, PyObject *]</dt><dd><p>Store a Python object in a C object pointer. This is similar to <code class="docutils literal notranslate"><span class="pre">O</span></code>, but
|
|
||||||
takes two C arguments: the first is the address of a Python type object, the
|
|
||||||
second is the address of the C variable (of type <span class="c-expr sig sig-inline c"><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n">PyObject</span></a><span class="p">*</span></span>) into which
|
|
||||||
the object pointer is stored. If the Python object does not have the required
|
|
||||||
type, <a class="reference internal" href="../library/exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a> is raised.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl id="o-ampersand">
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">O&</span></code> (object) [<em>converter</em>, <em>address</em>]</dt><dd><p>Convert a Python object to a C variable through a <em>converter</em> function. This
|
|
||||||
takes two arguments: the first is a function, the second is the address of a C
|
|
||||||
variable (of arbitrary type), converted to <span class="c-expr sig sig-inline c"><span class="kt">void</span><span class="p">*</span></span>. The <em>converter</em>
|
|
||||||
function in turn is called as follows:</p>
|
|
||||||
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">status</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">converter</span><span class="p">(</span><span class="n">object</span><span class="p">,</span><span class="w"> </span><span class="n">address</span><span class="p">);</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>where <em>object</em> is the Python object to be converted and <em>address</em> is the
|
|
||||||
<span class="c-expr sig sig-inline c"><span class="kt">void</span><span class="p">*</span></span> argument that was passed to the <code class="docutils literal notranslate"><span class="pre">PyArg_Parse*</span></code> function.
|
|
||||||
The returned <em>status</em> should be <code class="docutils literal notranslate"><span class="pre">1</span></code> for a successful conversion and <code class="docutils literal notranslate"><span class="pre">0</span></code> if
|
|
||||||
the conversion has failed. When the conversion fails, the <em>converter</em> function
|
|
||||||
should raise an exception and leave the content of <em>address</em> unmodified.</p>
|
|
||||||
<p id="c.Py_CLEANUP_SUPPORTED">If the <em>converter</em> returns <code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_CLEANUP_SUPPORTED</span></code>, it may get called a
|
|
||||||
second time if the argument parsing eventually fails, giving the converter a
|
|
||||||
chance to release any memory that it had already allocated. In this second
|
|
||||||
call, the <em>object</em> parameter will be <code class="docutils literal notranslate"><span class="pre">NULL</span></code>; <em>address</em> will have the same value
|
|
||||||
as in the original call.</p>
|
|
||||||
<p>Examples of converters: <a class="reference internal" href="unicode.html#c.PyUnicode_FSConverter" title="PyUnicode_FSConverter"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_FSConverter()</span></code></a> and
|
|
||||||
<a class="reference internal" href="unicode.html#c.PyUnicode_FSDecoder" title="PyUnicode_FSDecoder"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyUnicode_FSDecoder()</span></code></a>.</p>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.1: </span><code class="xref c c-macro docutils literal notranslate"><span class="pre">Py_CLEANUP_SUPPORTED</span></code> was added.</p>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">p</span></code> (<a class="reference internal" href="../library/functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) [int]</dt><dd><p>Tests the value passed in for truth (a boolean <strong>p</strong>redicate) and converts
|
|
||||||
the result to its equivalent C true/false integer value.
|
|
||||||
Sets the int to <code class="docutils literal notranslate"><span class="pre">1</span></code> if the expression was true and <code class="docutils literal notranslate"><span class="pre">0</span></code> if it was false.
|
|
||||||
This accepts any valid Python value. See <a class="reference internal" href="../library/stdtypes.html#truth"><span class="std std-ref">Truth Value Testing</span></a> for more
|
|
||||||
information about how Python tests values for truth.</p>
|
|
||||||
<div class="versionadded">
|
|
||||||
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">(items)</span></code> (<a class="reference internal" href="../library/stdtypes.html#tuple" title="tuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a>) [<em>matching-items</em>]</dt><dd><p>The object must be a Python sequence whose length is the number of format units
|
|
||||||
in <em>items</em>. The C arguments must correspond to the individual format units in
|
|
||||||
<em>items</em>. Format units for sequences may be nested.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<p>A few other characters have a meaning in a format string. These may not occur
|
|
||||||
inside nested parentheses. They are:</p>
|
|
||||||
<dl>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">|</span></code></dt><dd><p>Indicates that the remaining arguments in the Python argument list are optional.
|
|
||||||
The C variables corresponding to optional arguments should be initialized to
|
|
||||||
their default value — when an optional argument is not specified,
|
|
||||||
<a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> does not touch the contents of the corresponding C
|
|
||||||
variable(s).</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">$</span></code></dt><dd><p><a class="reference internal" href="#c.PyArg_ParseTupleAndKeywords" title="PyArg_ParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTupleAndKeywords()</span></code></a> only:
|
|
||||||
Indicates that the remaining arguments in the Python argument list are
|
|
||||||
keyword-only. Currently, all keyword-only arguments must also be optional
|
|
||||||
arguments, so <code class="docutils literal notranslate"><span class="pre">|</span></code> must always be specified before <code class="docutils literal notranslate"><span class="pre">$</span></code> in the format
|
|
||||||
string.</p>
|
|
||||||
<div class="versionadded">
|
|
||||||
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">:</span></code></dt><dd><p>The list of format units ends here; the string after the colon is used as the
|
|
||||||
function name in error messages (the “associated value” of the exception that
|
|
||||||
<a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a> raises).</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">;</span></code></dt><dd><p>The list of format units ends here; the string after the semicolon is used as
|
|
||||||
the error message <em>instead</em> of the default error message. <code class="docutils literal notranslate"><span class="pre">:</span></code> and <code class="docutils literal notranslate"><span class="pre">;</span></code>
|
|
||||||
mutually exclude each other.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<p>Note that any Python object references which are provided to the caller are
|
|
||||||
<em>borrowed</em> references; do not release them
|
|
||||||
(i.e. do not decrement their reference count)!</p>
|
|
||||||
<p>Additional arguments passed to these functions must be addresses of variables
|
|
||||||
whose type is determined by the format string; these are used to store values
|
|
||||||
from the input tuple. There are a few cases, as described in the list of format
|
|
||||||
units above, where these parameters are used as input values; they should match
|
|
||||||
what is specified for the corresponding format unit in that case.</p>
|
|
||||||
<p>For the conversion to succeed, the <em>arg</em> object must match the format
|
|
||||||
and the format must be exhausted. On success, the
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">PyArg_Parse*</span></code> functions return true, otherwise they return
|
|
||||||
false and raise an appropriate exception. When the
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">PyArg_Parse*</span></code> functions fail due to conversion failure in one
|
|
||||||
of the format units, the variables at the addresses corresponding to that
|
|
||||||
and the following format units are left untouched.</p>
|
|
||||||
</section>
|
|
||||||
<section id="api-functions">
|
|
||||||
<h3>API Functions<a class="headerlink" href="#api-functions" title="Link to this heading">¶</a></h3>
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_ParseTuple">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_ParseTuple</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="p"><span class="pre">...</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_ParseTuple" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Parse the parameters of a function that takes only positional parameters into
|
|
||||||
local variables. Returns true on success; on failure, it returns false and
|
|
||||||
raises the appropriate exception.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_VaParse">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_VaParse</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="n"><span class="pre">va_list</span></span><span class="w"> </span><span class="n"><span class="pre">vargs</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_VaParse" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Identical to <a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a>, except that it accepts a va_list rather
|
|
||||||
than a variable number of arguments.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_ParseTupleAndKeywords">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_ParseTupleAndKeywords</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">kw</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">keywords</span></span>, <span class="p"><span class="pre">...</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_ParseTupleAndKeywords" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Parse the parameters of a function that takes both positional and keyword
|
|
||||||
parameters into local variables.
|
|
||||||
The <em>keywords</em> argument is a <code class="docutils literal notranslate"><span class="pre">NULL</span></code>-terminated array of keyword parameter
|
|
||||||
names specified as null-terminated ASCII or UTF-8 encoded C strings.
|
|
||||||
Empty names denote
|
|
||||||
<a class="reference internal" href="../glossary.html#positional-only-parameter"><span class="std std-ref">positional-only parameters</span></a>.
|
|
||||||
Returns true on success; on failure, it returns false and raises the
|
|
||||||
appropriate exception.</p>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>The <em>keywords</em> parameter declaration is <span class="c-expr sig sig-inline c"><span class="kt">char</span><span class="w"> </span><span class="p">*</span><span class="k">const</span><span class="p">*</span></span> in C and
|
|
||||||
<span class="c-expr sig sig-inline c"><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="p">*</span><span class="k">const</span><span class="p">*</span></span> in C++.
|
|
||||||
This can be overridden with the <a class="reference internal" href="#c.PY_CXX_CONST" title="PY_CXX_CONST"><code class="xref c c-macro docutils literal notranslate"><span class="pre">PY_CXX_CONST</span></code></a> macro.</p>
|
|
||||||
</div>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.6: </span>Added support for <a class="reference internal" href="../glossary.html#positional-only-parameter"><span class="std std-ref">positional-only parameters</span></a>.</p>
|
|
||||||
</div>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.13: </span>The <em>keywords</em> parameter has now type <span class="c-expr sig sig-inline c"><span class="kt">char</span><span class="w"> </span><span class="p">*</span><span class="k">const</span><span class="p">*</span></span> in C and
|
|
||||||
<span class="c-expr sig sig-inline c"><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="p">*</span><span class="k">const</span><span class="p">*</span></span> in C++, instead of <span class="c-expr sig sig-inline c"><span class="kt">char</span><span class="p">*</span><span class="p">*</span></span>.
|
|
||||||
Added support for non-ASCII keyword parameter names.</p>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_VaParseTupleAndKeywords">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_VaParseTupleAndKeywords</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">kw</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">keywords</span></span>, <span class="n"><span class="pre">va_list</span></span><span class="w"> </span><span class="n"><span class="pre">vargs</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_VaParseTupleAndKeywords" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Identical to <a class="reference internal" href="#c.PyArg_ParseTupleAndKeywords" title="PyArg_ParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTupleAndKeywords()</span></code></a>, except that it accepts a
|
|
||||||
va_list rather than a variable number of arguments.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_ValidateKeywordArguments">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_ValidateKeywordArguments</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="p"><span class="pre">*</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_ValidateKeywordArguments" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Ensure that the keys in the keywords argument dictionary are strings. This
|
|
||||||
is only needed if <a class="reference internal" href="#c.PyArg_ParseTupleAndKeywords" title="PyArg_ParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTupleAndKeywords()</span></code></a> is not used, since the
|
|
||||||
latter already does this check.</p>
|
|
||||||
<div class="versionadded">
|
|
||||||
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_Parse">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_Parse</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="p"><span class="pre">...</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_Parse" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Parse the parameter of a function that takes a single positional parameter
|
|
||||||
into a local variable. Returns true on success; on failure, it returns
|
|
||||||
false and raises the appropriate exception.</p>
|
|
||||||
<p>Example:</p>
|
|
||||||
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="c1">// Function using METH_O calling convention</span>
|
|
||||||
<span class="k">static</span><span class="w"> </span><span class="n">PyObject</span><span class="o">*</span>
|
|
||||||
<span class="nf">my_function</span><span class="p">(</span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">module</span><span class="p">,</span><span class="w"> </span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">arg</span><span class="p">)</span>
|
|
||||||
<span class="p">{</span>
|
|
||||||
<span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">value</span><span class="p">;</span>
|
|
||||||
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="n">PyArg_Parse</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span><span class="w"> </span><span class="s">"i:my_function"</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">value</span><span class="p">))</span><span class="w"> </span><span class="p">{</span>
|
|
||||||
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span>
|
|
||||||
<span class="w"> </span><span class="p">}</span>
|
|
||||||
<span class="w"> </span><span class="c1">// ... use value ...</span>
|
|
||||||
<span class="p">}</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyArg_UnpackTuple">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyArg_UnpackTuple</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">name</span></span>, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="n"><span class="pre">min</span></span>, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><span class="n"><span class="pre">Py_ssize_t</span></span></a><span class="w"> </span><span class="n"><span class="pre">max</span></span>, <span class="p"><span class="pre">...</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyArg_UnpackTuple" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>A simpler form of parameter retrieval which does not use a format string to
|
|
||||||
specify the types of the arguments. Functions which use this method to retrieve
|
|
||||||
their parameters should be declared as <a class="reference internal" href="structures.html#c.METH_VARARGS" title="METH_VARARGS"><code class="xref c c-macro docutils literal notranslate"><span class="pre">METH_VARARGS</span></code></a> in function or
|
|
||||||
method tables. The tuple containing the actual parameters should be passed as
|
|
||||||
<em>args</em>; it must actually be a tuple. The length of the tuple must be at least
|
|
||||||
<em>min</em> and no more than <em>max</em>; <em>min</em> and <em>max</em> may be equal. Additional
|
|
||||||
arguments must be passed to the function, each of which should be a pointer to a
|
|
||||||
<span class="c-expr sig sig-inline c"><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n">PyObject</span></a><span class="p">*</span></span> variable; these will be filled in with the values from
|
|
||||||
<em>args</em>; they will contain <a class="reference internal" href="../glossary.html#term-borrowed-reference"><span class="xref std std-term">borrowed references</span></a>.
|
|
||||||
The variables which correspond
|
|
||||||
to optional parameters not given by <em>args</em> will not be filled in; these should
|
|
||||||
be initialized by the caller. This function returns true on success and false if
|
|
||||||
<em>args</em> is not a tuple or contains the wrong number of elements; an exception
|
|
||||||
will be set if there was a failure.</p>
|
|
||||||
<p>This is an example of the use of this function, taken from the sources for the
|
|
||||||
<code class="xref py py-mod docutils literal notranslate"><span class="pre">_weakref</span></code> helper module for weak references:</p>
|
|
||||||
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span>
|
|
||||||
<span class="nf">weakref_ref</span><span class="p">(</span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">self</span><span class="p">,</span><span class="w"> </span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
|
|
||||||
<span class="p">{</span>
|
|
||||||
<span class="w"> </span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">object</span><span class="p">;</span>
|
|
||||||
<span class="w"> </span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">callback</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span>
|
|
||||||
<span class="w"> </span><span class="n">PyObject</span><span class="w"> </span><span class="o">*</span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span>
|
|
||||||
|
|
||||||
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">PyArg_UnpackTuple</span><span class="p">(</span><span class="n">args</span><span class="p">,</span><span class="w"> </span><span class="s">"ref"</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">object</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">callback</span><span class="p">))</span><span class="w"> </span><span class="p">{</span>
|
|
||||||
<span class="w"> </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">PyWeakref_NewRef</span><span class="p">(</span><span class="n">object</span><span class="p">,</span><span class="w"> </span><span class="n">callback</span><span class="p">);</span>
|
|
||||||
<span class="w"> </span><span class="p">}</span>
|
|
||||||
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">result</span><span class="p">;</span>
|
|
||||||
<span class="p">}</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>The call to <a class="reference internal" href="#c.PyArg_UnpackTuple" title="PyArg_UnpackTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_UnpackTuple()</span></code></a> in this example is entirely equivalent to
|
|
||||||
this call to <a class="reference internal" href="#c.PyArg_ParseTuple" title="PyArg_ParseTuple"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTuple()</span></code></a>:</p>
|
|
||||||
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">PyArg_ParseTuple</span><span class="p">(</span><span class="n">args</span><span class="p">,</span><span class="w"> </span><span class="s">"O|O:ref"</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">object</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">callback</span><span class="p">)</span>
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.PY_CXX_CONST">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">PY_CXX_CONST</span></span></span><a class="headerlink" href="#c.PY_CXX_CONST" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The value to be inserted, if any, before <span class="c-expr sig sig-inline c"><span class="kt">char</span><span class="w"> </span><span class="p">*</span><span class="k">const</span><span class="p">*</span></span>
|
|
||||||
in the <em>keywords</em> parameter declaration of
|
|
||||||
<a class="reference internal" href="#c.PyArg_ParseTupleAndKeywords" title="PyArg_ParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_ParseTupleAndKeywords()</span></code></a> and
|
|
||||||
<a class="reference internal" href="#c.PyArg_VaParseTupleAndKeywords" title="PyArg_VaParseTupleAndKeywords"><code class="xref c c-func docutils literal notranslate"><span class="pre">PyArg_VaParseTupleAndKeywords()</span></code></a>.
|
|
||||||
Default empty for C and <code class="docutils literal notranslate"><span class="pre">const</span></code> for C++
|
|
||||||
(<span class="c-expr sig sig-inline c"><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="p">*</span><span class="k">const</span><span class="p">*</span></span>).
|
|
||||||
To override, define it to the desired value before including
|
|
||||||
<code class="file docutils literal notranslate"><span class="pre">Python.h</span></code>.</p>
|
|
||||||
<div class="versionadded">
|
|
||||||
<p><span class="versionmodified added">Added in version 3.13.</span></p>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="building-values">
|
|
||||||
<h2>Building values<a class="headerlink" href="#building-values" title="Link to this heading">¶</a></h2>
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_BuildValue">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">Py_BuildValue</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="p"><span class="pre">...</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.Py_BuildValue" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_new_ref">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Create a new value based on a format string similar to those accepted by the
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">PyArg_Parse*</span></code> family of functions and a sequence of values. Returns
|
|
||||||
the value or <code class="docutils literal notranslate"><span class="pre">NULL</span></code> in the case of an error; an exception will be raised if
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">NULL</span></code> is returned.</p>
|
|
||||||
<p><a class="reference internal" href="#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a> does not always build a tuple. It builds a tuple only if
|
|
||||||
its format string contains two or more format units. If the format string is
|
|
||||||
empty, it returns <code class="docutils literal notranslate"><span class="pre">None</span></code>; if it contains exactly one format unit, it returns
|
|
||||||
whatever object is described by that format unit. To force it to return a tuple
|
|
||||||
of size 0 or one, parenthesize the format string.</p>
|
|
||||||
<p>When memory buffers are passed as parameters to supply data to build objects, as
|
|
||||||
for the <code class="docutils literal notranslate"><span class="pre">s</span></code> and <code class="docutils literal notranslate"><span class="pre">s#</span></code> formats, the required data is copied. Buffers provided
|
|
||||||
by the caller are never referenced by the objects created by
|
|
||||||
<a class="reference internal" href="#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a>. In other words, if your code invokes <code class="xref c c-func docutils literal notranslate"><span class="pre">malloc()</span></code>
|
|
||||||
and passes the allocated memory to <a class="reference internal" href="#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a>, your code is
|
|
||||||
responsible for calling <code class="xref c c-func docutils literal notranslate"><span class="pre">free()</span></code> for that memory once
|
|
||||||
<a class="reference internal" href="#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a> returns.</p>
|
|
||||||
<p>In the following description, the quoted form is the format unit; the entry in
|
|
||||||
(round) parentheses is the Python object type that the format unit will return;
|
|
||||||
and the entry in [square] brackets is the type of the C value(s) to be passed.</p>
|
|
||||||
<p>The characters space, tab, colon and comma are ignored in format strings (but
|
|
||||||
not within format units such as <code class="docutils literal notranslate"><span class="pre">s#</span></code>). This can be used to make long format
|
|
||||||
strings a tad more readable.</p>
|
|
||||||
<dl class="simple">
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">s</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *]</dt><dd><p>Convert a null-terminated C string to a Python <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> object using <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code>
|
|
||||||
encoding. If the C string pointer is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code> is used.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">s#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Convert a C string and its length to a Python <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> object using <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code>
|
|
||||||
encoding. If the C string pointer is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, the length is ignored and
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">None</span></code> is returned.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">y</span></code> (<a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>) [const char *]</dt><dd><p>This converts a C string to a Python <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> object. If the C
|
|
||||||
string pointer is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">y#</span></code> (<a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>This converts a C string and its lengths to a Python object. If the C
|
|
||||||
string pointer is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">z</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">s</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">z#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">s#</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">u</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) [const wchar_t *]</dt><dd><p>Convert a null-terminated <code class="xref c c-type docutils literal notranslate"><span class="pre">wchar_t</span></code> buffer of Unicode (UTF-16 or UCS-4)
|
|
||||||
data to a Python Unicode object. If the Unicode buffer pointer is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>,
|
|
||||||
<code class="docutils literal notranslate"><span class="pre">None</span></code> is returned.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">u#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) [const wchar_t *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python
|
|
||||||
Unicode object. If the Unicode buffer pointer is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, the length is ignored
|
|
||||||
and <code class="docutils literal notranslate"><span class="pre">None</span></code> is returned.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">U</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">s</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">U#</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> or <code class="docutils literal notranslate"><span class="pre">None</span></code>) [const char *, <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">s#</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">i</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [int]</dt><dd><p>Convert a plain C <span class="c-expr sig sig-inline c"><span class="kt">int</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">b</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [char]</dt><dd><p>Convert a plain C <span class="c-expr sig sig-inline c"><span class="kt">char</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">h</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [short int]</dt><dd><p>Convert a plain C <span class="c-expr sig sig-inline c"><span class="kt">short</span><span class="w"> </span><span class="kt">int</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">l</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [long int]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">long</span><span class="w"> </span><span class="kt">int</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">B</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned char]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">char</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">H</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned short int]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">short</span><span class="w"> </span><span class="kt">int</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">I</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned int]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">k</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned long]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">long</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">L</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [long long]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">long</span><span class="w"> </span><span class="kt">long</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">K</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [unsigned long long]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">unsigned</span><span class="w"> </span><span class="kt">long</span><span class="w"> </span><span class="kt">long</span></span> to a Python integer object.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">n</span></code> (<a class="reference internal" href="../library/functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>) [<a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a>]</dt><dd><p>Convert a C <a class="reference internal" href="intro.html#c.Py_ssize_t" title="Py_ssize_t"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_ssize_t</span></code></a> to a Python integer.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">c</span></code> (<a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> of length 1) [char]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">int</span></span> representing a byte to a Python <a class="reference internal" href="../library/stdtypes.html#bytes" title="bytes"><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></a> object of
|
|
||||||
length 1.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">C</span></code> (<a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> of length 1) [int]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">int</span></span> representing a character to Python <a class="reference internal" href="../library/stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>
|
|
||||||
object of length 1.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">d</span></code> (<a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) [double]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">double</span></span> to a Python floating-point number.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">f</span></code> (<a class="reference internal" href="../library/functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>) [float]</dt><dd><p>Convert a C <span class="c-expr sig sig-inline c"><span class="kt">float</span></span> to a Python floating-point number.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">D</span></code> (<a class="reference internal" href="../library/functions.html#complex" title="complex"><code class="xref py py-class docutils literal notranslate"><span class="pre">complex</span></code></a>) [Py_complex *]</dt><dd><p>Convert a C <a class="reference internal" href="complex.html#c.Py_complex" title="Py_complex"><code class="xref c c-type docutils literal notranslate"><span class="pre">Py_complex</span></code></a> structure to a Python complex number.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">O</span></code> (object) [PyObject *]</dt><dd><p>Pass a Python object untouched but create a new
|
|
||||||
<a class="reference internal" href="../glossary.html#term-strong-reference"><span class="xref std std-term">strong reference</span></a> to it
|
|
||||||
(i.e. its reference count is incremented by one).
|
|
||||||
If the object passed in is a <code class="docutils literal notranslate"><span class="pre">NULL</span></code> pointer, it is assumed
|
|
||||||
that this was caused because the call producing the argument found an error and
|
|
||||||
set an exception. Therefore, <a class="reference internal" href="#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a> will return <code class="docutils literal notranslate"><span class="pre">NULL</span></code> but won’t
|
|
||||||
raise an exception. If no exception has been raised yet, <a class="reference internal" href="../library/exceptions.html#SystemError" title="SystemError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SystemError</span></code></a> is
|
|
||||||
set.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">S</span></code> (object) [PyObject *]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">O</span></code>.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">N</span></code> (object) [PyObject *]</dt><dd><p>Same as <code class="docutils literal notranslate"><span class="pre">O</span></code>, except it doesn’t create a new <a class="reference internal" href="../glossary.html#term-strong-reference"><span class="xref std std-term">strong reference</span></a>.
|
|
||||||
Useful when the object is created by a call to an object constructor in the
|
|
||||||
argument list.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">O&</span></code> (object) [<em>converter</em>, <em>anything</em>]</dt><dd><p>Convert <em>anything</em> to a Python object through a <em>converter</em> function. The
|
|
||||||
function is called with <em>anything</em> (which should be compatible with <span class="c-expr sig sig-inline c"><span class="kt">void</span><span class="p">*</span></span>)
|
|
||||||
as its argument and should return a “new” Python object, or <code class="docutils literal notranslate"><span class="pre">NULL</span></code> if an
|
|
||||||
error occurred.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">(items)</span></code> (<a class="reference internal" href="../library/stdtypes.html#tuple" title="tuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a>) [<em>matching-items</em>]</dt><dd><p>Convert a sequence of C values to a Python tuple with the same number of items.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">[items]</span></code> (<a class="reference internal" href="../library/stdtypes.html#list" title="list"><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></a>) [<em>matching-items</em>]</dt><dd><p>Convert a sequence of C values to a Python list with the same number of items.</p>
|
|
||||||
</dd>
|
|
||||||
<dt><code class="docutils literal notranslate"><span class="pre">{items}</span></code> (<a class="reference internal" href="../library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>) [<em>matching-items</em>]</dt><dd><p>Convert a sequence of C values to a Python dictionary. Each pair of consecutive
|
|
||||||
C values adds one item to the dictionary, serving as key and value,
|
|
||||||
respectively.</p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<p>If there is an error in the format string, the <a class="reference internal" href="../library/exceptions.html#SystemError" title="SystemError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SystemError</span></code></a> exception is
|
|
||||||
set and <code class="docutils literal notranslate"><span class="pre">NULL</span></code> returned.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_VaBuildValue">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">Py_VaBuildValue</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">format</span></span>, <span class="n"><span class="pre">va_list</span></span><span class="w"> </span><span class="n"><span class="pre">vargs</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.Py_VaBuildValue" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_new_ref">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Identical to <a class="reference internal" href="#c.Py_BuildValue" title="Py_BuildValue"><code class="xref c c-func docutils literal notranslate"><span class="pre">Py_BuildValue()</span></code></a>, except that it accepts a va_list
|
|
||||||
rather than a variable number of arguments.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h3><a href="../contents.html">Table of Contents</a></h3>
|
|
||||||
<ul>
|
|
||||||
<li><a class="reference internal" href="#">Parsing arguments and building values</a><ul>
|
|
||||||
<li><a class="reference internal" href="#parsing-arguments">Parsing arguments</a><ul>
|
|
||||||
<li><a class="reference internal" href="#strings-and-buffers">Strings and buffers</a></li>
|
|
||||||
<li><a class="reference internal" href="#numbers">Numbers</a></li>
|
|
||||||
<li><a class="reference internal" href="#other-objects">Other objects</a></li>
|
|
||||||
<li><a class="reference internal" href="#api-functions">API Functions</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a class="reference internal" href="#building-values">Building values</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="marshal.html"
|
|
||||||
title="previous chapter">Data marshalling support</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="conversion.html"
|
|
||||||
title="next chapter">String conversion and formatting</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/arg.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="conversion.html" title="String conversion and formatting"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="marshal.html" title="Data marshalling support"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-2"><a href="utilities.html" >Utilities</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Parsing arguments and building values</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="../copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
369
Dependencies/Python/Doc/html/c-api/bool.html
vendored
@ -1,369 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
<html lang="en" data-content_root="../">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta property="og:title" content="Boolean Objects" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:url" content="https://docs.python.org/3/c-api/bool.html" />
|
|
||||||
<meta property="og:site_name" content="Python documentation" />
|
|
||||||
<meta property="og:description" content="Booleans in Python are implemented as a subclass of integers. There are only two booleans, Py_False and Py_True. As such, the normal creation and deletion functions don’t apply to booleans. The fol..." />
|
|
||||||
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
|
|
||||||
<meta property="og:image:alt" content="Python documentation" />
|
|
||||||
<meta name="description" content="Booleans in Python are implemented as a subclass of integers. There are only two booleans, Py_False and Py_True. As such, the normal creation and deletion functions don’t apply to booleans. The fol..." />
|
|
||||||
<meta property="og:image:width" content="200">
|
|
||||||
<meta property="og:image:height" content="200">
|
|
||||||
<meta name="theme-color" content="#3776ab">
|
|
||||||
|
|
||||||
<title>Boolean Objects — Python 3.13.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=23252803" />
|
|
||||||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />
|
|
||||||
|
|
||||||
<script src="../_static/documentation_options.js?v=5d57ca2d"></script>
|
|
||||||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
|
||||||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
||||||
|
|
||||||
<script src="../_static/sidebar.js"></script>
|
|
||||||
|
|
||||||
<link rel="search" type="application/opensearchdescription+xml"
|
|
||||||
title="Search within Python 3.13.3 documentation"
|
|
||||||
href="../_static/opensearch.xml"/>
|
|
||||||
<link rel="author" title="About these documents" href="../about.html" />
|
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
|
||||||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|
||||||
<link rel="next" title="Floating-Point Objects" href="float.html" />
|
|
||||||
<link rel="prev" title="Integer Objects" href="long.html" />
|
|
||||||
|
|
||||||
<link rel="canonical" href="https://docs.python.org/3/c-api/bool.html">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media only screen {
|
|
||||||
table.full-width-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
|
||||||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/menu.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
|
||||||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
|
||||||
<meta name="readthedocs-addons-api-version" content="1">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="mobile-nav">
|
|
||||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
|
||||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
|
||||||
<nav class="nav-content" role="navigation">
|
|
||||||
<label for="menuToggler" class="toggler__label">
|
|
||||||
<span></span>
|
|
||||||
</label>
|
|
||||||
<span class="nav-items-wrapper">
|
|
||||||
<a href="https://www.python.org/" class="nav-logo">
|
|
||||||
<img src="../_static/py.svg" alt="Python logo"/>
|
|
||||||
</a>
|
|
||||||
<span class="version_switcher_placeholder"></span>
|
|
||||||
<form role="search" class="search" action="../search.html" method="get">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
|
||||||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
|
||||||
</svg>
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
|
|
||||||
<input type="submit" value="Go"/>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</nav>
|
|
||||||
<div class="menu-wrapper">
|
|
||||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="long.html"
|
|
||||||
title="previous chapter">Integer Objects</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="float.html"
|
|
||||||
title="next chapter">Floating-Point Objects</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/bool.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
accesskey="I">index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="float.html" title="Floating-Point Objects"
|
|
||||||
accesskey="N">next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="long.html" title="Integer Objects"
|
|
||||||
accesskey="P">previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-2"><a href="concrete.html" accesskey="U">Concrete Objects Layer</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Boolean Objects</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document">
|
|
||||||
<div class="documentwrapper">
|
|
||||||
<div class="bodywrapper">
|
|
||||||
<div class="body" role="main">
|
|
||||||
|
|
||||||
<section id="boolean-objects">
|
|
||||||
<span id="boolobjects"></span><h1>Boolean Objects<a class="headerlink" href="#boolean-objects" title="Link to this heading">¶</a></h1>
|
|
||||||
<p>Booleans in Python are implemented as a subclass of integers. There are only
|
|
||||||
two booleans, <a class="reference internal" href="#c.Py_False" title="Py_False"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_False</span></code></a> and <a class="reference internal" href="#c.Py_True" title="Py_True"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_True</span></code></a>. As such, the normal
|
|
||||||
creation and deletion functions don’t apply to booleans. The following macros
|
|
||||||
are available, however.</p>
|
|
||||||
<dl class="c var">
|
|
||||||
<dt class="sig sig-object c" id="c.PyBool_Type">
|
|
||||||
<a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><span class="n"><span class="pre">PyTypeObject</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyBool_Type</span></span></span><a class="headerlink" href="#c.PyBool_Type" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>This instance of <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><code class="xref c c-type docutils literal notranslate"><span class="pre">PyTypeObject</span></code></a> represents the Python boolean type; it
|
|
||||||
is the same object as <a class="reference internal" href="../library/functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a> in the Python layer.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyBool_Check">
|
|
||||||
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">PyBool_Check</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">o</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyBool_Check" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Return true if <em>o</em> is of type <a class="reference internal" href="#c.PyBool_Type" title="PyBool_Type"><code class="xref c c-data docutils literal notranslate"><span class="pre">PyBool_Type</span></code></a>. This function always
|
|
||||||
succeeds.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c var">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_False">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">Py_False</span></span></span><a class="headerlink" href="#c.Py_False" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The Python <code class="docutils literal notranslate"><span class="pre">False</span></code> object. This object has no methods and is
|
|
||||||
<a class="reference internal" href="../glossary.html#term-immortal"><span class="xref std std-term">immortal</span></a>.</p>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.12: </span><a class="reference internal" href="#c.Py_False" title="Py_False"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_False</span></code></a> is <a class="reference internal" href="../glossary.html#term-immortal"><span class="xref std std-term">immortal</span></a>.</p>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c var">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_True">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">Py_True</span></span></span><a class="headerlink" href="#c.Py_True" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>The Python <code class="docutils literal notranslate"><span class="pre">True</span></code> object. This object has no methods and is
|
|
||||||
<a class="reference internal" href="../glossary.html#term-immortal"><span class="xref std std-term">immortal</span></a>.</p>
|
|
||||||
<div class="versionchanged">
|
|
||||||
<p><span class="versionmodified changed">Changed in version 3.12: </span><a class="reference internal" href="#c.Py_True" title="Py_True"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_True</span></code></a> is <a class="reference internal" href="../glossary.html#term-immortal"><span class="xref std std-term">immortal</span></a>.</p>
|
|
||||||
</div>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_RETURN_FALSE">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">Py_RETURN_FALSE</span></span></span><a class="headerlink" href="#c.Py_RETURN_FALSE" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Return <a class="reference internal" href="#c.Py_False" title="Py_False"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_False</span></code></a> from a function.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c macro">
|
|
||||||
<dt class="sig sig-object c" id="c.Py_RETURN_TRUE">
|
|
||||||
<span class="sig-name descname"><span class="n"><span class="pre">Py_RETURN_TRUE</span></span></span><a class="headerlink" href="#c.Py_RETURN_TRUE" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><p>Return <a class="reference internal" href="#c.Py_True" title="Py_True"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_True</span></code></a> from a function.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="c function">
|
|
||||||
<dt class="sig sig-object c" id="c.PyBool_FromLong">
|
|
||||||
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject"><span class="n"><span class="pre">PyObject</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">PyBool_FromLong</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="n"><span class="pre">v</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyBool_FromLong" title="Link to this definition">¶</a><br /></dt>
|
|
||||||
<dd><em class="refcount return_new_ref">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable.html#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return <a class="reference internal" href="#c.Py_True" title="Py_True"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_True</span></code></a> or <a class="reference internal" href="#c.Py_False" title="Py_False"><code class="xref c c-data docutils literal notranslate"><span class="pre">Py_False</span></code></a>, depending on the truth value of <em>v</em>.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
|
||||||
<div class="sphinxsidebarwrapper">
|
|
||||||
<div>
|
|
||||||
<h4>Previous topic</h4>
|
|
||||||
<p class="topless"><a href="long.html"
|
|
||||||
title="previous chapter">Integer Objects</a></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Next topic</h4>
|
|
||||||
<p class="topless"><a href="float.html"
|
|
||||||
title="next chapter">Floating-Point Objects</a></p>
|
|
||||||
</div>
|
|
||||||
<div role="note" aria-label="source link">
|
|
||||||
<h3>This Page</h3>
|
|
||||||
<ul class="this-page-menu">
|
|
||||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/python/cpython/blob/main/Doc/c-api/bool.rst"
|
|
||||||
rel="nofollow">Show Source
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="sidebarbutton" title="Collapse sidebar">
|
|
||||||
<span>«</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="clearer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="related" role="navigation" aria-label="Related">
|
|
||||||
<h3>Navigation</h3>
|
|
||||||
<ul>
|
|
||||||
<li class="right" style="margin-right: 10px">
|
|
||||||
<a href="../genindex.html" title="General Index"
|
|
||||||
>index</a></li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="../py-modindex.html" title="Python Module Index"
|
|
||||||
>modules</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="float.html" title="Floating-Point Objects"
|
|
||||||
>next</a> |</li>
|
|
||||||
<li class="right" >
|
|
||||||
<a href="long.html" title="Integer Objects"
|
|
||||||
>previous</a> |</li>
|
|
||||||
|
|
||||||
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
|
||||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
|
||||||
<li class="switchers">
|
|
||||||
<div class="language_switcher_placeholder"></div>
|
|
||||||
<div class="version_switcher_placeholder"></div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<li id="cpython-language-and-version">
|
|
||||||
<a href="../index.html">3.13.3 Documentation</a> »
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
|
|
||||||
<li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> »</li>
|
|
||||||
<li class="nav-item nav-item-this"><a href="">Boolean Objects</a></li>
|
|
||||||
<li class="right">
|
|
||||||
|
|
||||||
|
|
||||||
<div class="inline-search" role="search">
|
|
||||||
<form class="inline-search" action="../search.html" method="get">
|
|
||||||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
|
|
||||||
<input type="submit" value="Go" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
</li>
|
|
||||||
<li class="right">
|
|
||||||
<label class="theme-selector-label">
|
|
||||||
Theme
|
|
||||||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
|
||||||
<option value="auto" selected>Auto</option>
|
|
||||||
<option value="light">Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</label> |</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="footer">
|
|
||||||
©
|
|
||||||
<a href="../copyright.html">
|
|
||||||
|
|
||||||
Copyright
|
|
||||||
|
|
||||||
</a>
|
|
||||||
2001-2025, Python Software Foundation.
|
|
||||||
<br />
|
|
||||||
This page is licensed under the Python Software Foundation License Version 2.
|
|
||||||
<br />
|
|
||||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
|
||||||
<br />
|
|
||||||
|
|
||||||
See <a href="/license.html">History and License</a> for more information.<br />
|
|
||||||
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
The Python Software Foundation is a non-profit corporation.
|
|
||||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Last updated on Apr 08, 2025 (14:33 UTC).
|
|
||||||
|
|
||||||
<a href="/bugs.html">Found a bug</a>?
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|