split platform
This commit is contained in:
commit
8c9b09577d
2261 changed files with 676163 additions and 0 deletions
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
*.swp
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
__pycache__
|
||||||
|
pip_cache
|
||||||
|
.DS_Store
|
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftAppKit.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftAppKit.dylib
Executable file
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftCore.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftCore.dylib
Executable file
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftCoreData.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftCoreData.dylib
Executable file
Binary file not shown.
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftCoreImage.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftCoreImage.dylib
Executable file
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftDarwin.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftDarwin.dylib
Executable file
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftDispatch.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftDispatch.dylib
Executable file
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftFoundation.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftFoundation.dylib
Executable file
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftObjectiveC.dylib
Executable file
BIN
Applications/Open Media Library.app/Contents/Frameworks/libswiftObjectiveC.dylib
Executable file
Binary file not shown.
56
Applications/Open Media Library.app/Contents/Info.plist
Normal file
56
Applications/Open Media Library.app/Contents/Info.plist
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>BuildMachineOSBuild</key>
|
||||||
|
<string>15D21</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>Open Media Library</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>AppIcon</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.openmedialibrary.Open-Media-Library</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Open Media Library</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>0.6</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>DTCompiler</key>
|
||||||
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||||
|
<key>DTPlatformBuild</key>
|
||||||
|
<string>7C68</string>
|
||||||
|
<key>DTPlatformVersion</key>
|
||||||
|
<string>GM</string>
|
||||||
|
<key>DTSDKBuild</key>
|
||||||
|
<string>15C43</string>
|
||||||
|
<key>DTSDKName</key>
|
||||||
|
<string>macosx10.11</string>
|
||||||
|
<key>DTXcode</key>
|
||||||
|
<string>0720</string>
|
||||||
|
<key>DTXcodeBuild</key>
|
||||||
|
<string>7C68</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.11</string>
|
||||||
|
<key>LSUIElement</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright © 2015 Open Media Library. All rights reserved.</string>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string>MainMenu</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
BIN
Applications/Open Media Library.app/Contents/MacOS/Open Media Library
Executable file
BIN
Applications/Open Media Library.app/Contents/MacOS/Open Media Library
Executable file
Binary file not shown.
1
Applications/Open Media Library.app/Contents/PkgInfo
Normal file
1
Applications/Open Media Library.app/Contents/PkgInfo
Normal file
|
@ -0,0 +1 @@
|
||||||
|
APPL????
|
Binary file not shown.
Binary file not shown.
BIN
Applications/Open Media Library.app/Contents/Resources/Base.lproj/MainMenu.nib
generated
Normal file
BIN
Applications/Open Media Library.app/Contents/Resources/Base.lproj/MainMenu.nib
generated
Normal file
Binary file not shown.
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Open Media Library</title>
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<link href="/png/oml.png" rel="icon" type="image/png">
|
||||||
|
<script src="/js/install.js" type="text/javascript"></script>
|
||||||
|
<meta name="google" value="notranslate"/>
|
||||||
|
</head>
|
||||||
|
<body></body>
|
||||||
|
</html>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Open Media Library</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
function load() {
|
||||||
|
var base = 'http://127.0.0.1:9841';
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.onload = function() {
|
||||||
|
document.location.href = base;
|
||||||
|
};
|
||||||
|
xhr.onerror = function() {
|
||||||
|
setTimeout(load, 1000);
|
||||||
|
}
|
||||||
|
xhr.open('get', base + '/status');
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
load();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
136
Applications/Open Media Library.app/Contents/Resources/install.py
Executable file
136
Applications/Open Media Library.app/Contents/Resources/install.py
Executable file
|
@ -0,0 +1,136 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
from __future__ import division, with_statement
|
||||||
|
|
||||||
|
from contextlib import closing
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import tarfile
|
||||||
|
import urllib2
|
||||||
|
import SimpleHTTPServer
|
||||||
|
import SocketServer
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
|
|
||||||
|
PORT = 9841
|
||||||
|
static_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
|
||||||
|
|
||||||
|
def makedirs(dirname):
|
||||||
|
if not os.path.exists(dirname):
|
||||||
|
os.makedirs(dirname)
|
||||||
|
|
||||||
|
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
|
def do_OPTIONS(self):
|
||||||
|
self.send_response(200, 'OK')
|
||||||
|
self.send_header('Allow', 'GET, POST, OPTIONS')
|
||||||
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
|
self.send_header('Access-Control-Allow-Headers', 'X-Requested-With')
|
||||||
|
self.send_header('Content-Length', '0')
|
||||||
|
self.end_headers()
|
||||||
|
|
||||||
|
def do_GET(self):
|
||||||
|
|
||||||
|
if self.path == '/status':
|
||||||
|
content = json.dumps(self.server.install.status)
|
||||||
|
self.send_response(200, 'OK')
|
||||||
|
else:
|
||||||
|
path = os.path.join(static_dir, 'index.html' if self.path == '/' else self.path[1:])
|
||||||
|
if os.path.exists(path):
|
||||||
|
with open(path) as fd:
|
||||||
|
content = fd.read()
|
||||||
|
self.send_response(200, 'OK')
|
||||||
|
content_type = {
|
||||||
|
'html': 'text/html',
|
||||||
|
'png': 'image/png',
|
||||||
|
'svg': 'image/svg+xml',
|
||||||
|
'txt': 'text/plain',
|
||||||
|
}.get(path.split('.')[-1], 'txt')
|
||||||
|
self.send_header('Content-Type', content_type)
|
||||||
|
else:
|
||||||
|
self.send_response(404, 'not found')
|
||||||
|
content = '404 not found'
|
||||||
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
|
self.send_header('Content-Length', str(len(content)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
class Install(Thread):
|
||||||
|
|
||||||
|
release_url = "http://downloads.openmedialibrary.com/release.json"
|
||||||
|
status = {
|
||||||
|
'step': 'Downloading...'
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, target, httpd):
|
||||||
|
target = os.path.normpath(os.path.join(os.path.abspath(target)))
|
||||||
|
self.target = target
|
||||||
|
self.httpd = httpd
|
||||||
|
Thread.__init__(self)
|
||||||
|
self.daemon = True
|
||||||
|
self.start()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
target = self.target
|
||||||
|
makedirs(target)
|
||||||
|
os.chdir(target)
|
||||||
|
self.status["step"] = 'Downloading...'
|
||||||
|
release = self.get_release()
|
||||||
|
self.status["release"] = release
|
||||||
|
self.status["progress"] = 0
|
||||||
|
for module in sorted(release['modules']):
|
||||||
|
package_tar = release['modules'][module]['name']
|
||||||
|
url = self.release_url.replace('release.json', package_tar)
|
||||||
|
self.download(url, package_tar)
|
||||||
|
self.status["step"] = 'Installing...'
|
||||||
|
for module in sorted(release['modules']):
|
||||||
|
package_tar = release['modules'][module]['name']
|
||||||
|
tar = tarfile.open(package_tar)
|
||||||
|
tar.extractall()
|
||||||
|
tar.close()
|
||||||
|
os.unlink(package_tar)
|
||||||
|
os.symlink('openmedialibrary/ctl', 'ctl')
|
||||||
|
makedirs('data')
|
||||||
|
with open('data/release.json', 'w') as fd:
|
||||||
|
json.dump(release, fd, indent=2)
|
||||||
|
self.status = {"relaunch": True}
|
||||||
|
os.system("./ctl start &")
|
||||||
|
time.sleep(5)
|
||||||
|
self.httpd.shutdown()
|
||||||
|
|
||||||
|
def download(self, url, filename):
|
||||||
|
dirname = os.path.dirname(filename)
|
||||||
|
if dirname:
|
||||||
|
makedirs(dirname)
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
with closing(urllib2.urlopen(url)) as u:
|
||||||
|
size = int(u.headers.get('content-length', 0))
|
||||||
|
self.status["size"] = size
|
||||||
|
available = 0
|
||||||
|
data = u.read(4096)
|
||||||
|
while data:
|
||||||
|
if size:
|
||||||
|
available += len(data)
|
||||||
|
f.write(data)
|
||||||
|
data = u.read(4096)
|
||||||
|
|
||||||
|
def get_release(self):
|
||||||
|
with closing(urllib2.urlopen(self.release_url)) as u:
|
||||||
|
data = json.load(u)
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
target = os.path.expanduser("~/Library/Application Support/Open Media Library")
|
||||||
|
elif len(sys.argv) != 2:
|
||||||
|
print "usage: %s [target]" % sys.argv[0]
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
target = sys.argv[1]
|
||||||
|
SocketServer.TCPServer.allow_reuse_address = True
|
||||||
|
httpd = SocketServer.TCPServer(("", PORT), Handler)
|
||||||
|
install = Install(target, httpd)
|
||||||
|
httpd.install = install
|
||||||
|
httpd.serve_forever()
|
|
@ -0,0 +1,148 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
loadImages(function(images) {
|
||||||
|
loadScreen(images);
|
||||||
|
initUpdate();
|
||||||
|
});
|
||||||
|
|
||||||
|
function initUpdate(browserSupported) {
|
||||||
|
window.update = {};
|
||||||
|
update.status = document.createElement('div');
|
||||||
|
update.status.className = 'OxElement';
|
||||||
|
update.status.style.position = 'absolute';
|
||||||
|
update.status.style.left = '16px';
|
||||||
|
update.status.style.top = '336px';
|
||||||
|
update.status.style.right = 0;
|
||||||
|
update.status.style.bottom = 0;
|
||||||
|
update.status.style.width = '512px';
|
||||||
|
update.status.style.height = '16px';
|
||||||
|
update.status.style.margin = 'auto';
|
||||||
|
update.status.style.textAlign = 'center';
|
||||||
|
update.status.style.color = 'rgb(16, 16, 16)';
|
||||||
|
update.status.style.fontFamily = 'Lucida Grande, Segoe UI, DejaVu Sans, Lucida Sans Unicode, Helvetica, Arial, sans-serif';
|
||||||
|
update.status.style.fontSize = '11px';
|
||||||
|
document.querySelector('#loadingScreen').appendChild(update.status);
|
||||||
|
update.status.innerHTML = '';
|
||||||
|
updateStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
var base = '//127.0.0.1:9842',
|
||||||
|
ws = new WebSocket('ws:' + base + '/ws');
|
||||||
|
ws.onopen = function(event) {
|
||||||
|
document.location.href = 'http:' + base;
|
||||||
|
};
|
||||||
|
ws.onerror = function(event) {
|
||||||
|
ws.close();
|
||||||
|
setTimeout(load, 500);
|
||||||
|
};
|
||||||
|
ws.onclose = function(event) {
|
||||||
|
setTimeout(load, 500);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadImages(callback) {
|
||||||
|
var images = {};
|
||||||
|
images.logo = document.createElement('img');
|
||||||
|
images.logo.onload = function() {
|
||||||
|
images.logo.style.position = 'absolute';
|
||||||
|
images.logo.style.left = 0;
|
||||||
|
images.logo.style.top = 0;
|
||||||
|
images.logo.style.right = 0;
|
||||||
|
images.logo.style.bottom = '96px';
|
||||||
|
images.logo.style.width = '256px';
|
||||||
|
images.logo.style.height = '256px';
|
||||||
|
images.logo.style.margin = 'auto';
|
||||||
|
images.logo.style.MozUserSelect = 'none';
|
||||||
|
images.logo.style.MSUserSelect = 'none';
|
||||||
|
images.logo.style.OUserSelect = 'none';
|
||||||
|
images.logo.style.WebkitUserSelect = 'none';
|
||||||
|
images.loadingIcon = document.createElement('img');
|
||||||
|
images.loadingIcon.setAttribute('id', 'loadingIcon');
|
||||||
|
images.loadingIcon.style.position = 'absolute';
|
||||||
|
images.loadingIcon.style.left = '16px';
|
||||||
|
images.loadingIcon.style.top = '256px'
|
||||||
|
images.loadingIcon.style.right = 0;
|
||||||
|
images.loadingIcon.style.bottom = 0;
|
||||||
|
images.loadingIcon.style.width = '32px';
|
||||||
|
images.loadingIcon.style.height = '32px';
|
||||||
|
images.loadingIcon.style.margin = 'auto';
|
||||||
|
images.loadingIcon.style.MozUserSelect = 'none';
|
||||||
|
images.loadingIcon.style.MSUserSelect = 'none';
|
||||||
|
images.loadingIcon.style.OUserSelect = 'none';
|
||||||
|
images.loadingIcon.style.WebkitUserSelect = 'none';
|
||||||
|
images.loadingIcon.src = '/svg/symbolLoading.svg';
|
||||||
|
callback(images);
|
||||||
|
};
|
||||||
|
images.logo.src = '/png/oml.png';
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadScreen(images) {
|
||||||
|
var loadingScreen = document.createElement('div');
|
||||||
|
loadingScreen.setAttribute('id', 'loadingScreen');
|
||||||
|
loadingScreen.className = 'OxScreen';
|
||||||
|
loadingScreen.style.position = 'absolute';
|
||||||
|
loadingScreen.style.width = '100%';
|
||||||
|
loadingScreen.style.height = '100%';
|
||||||
|
loadingScreen.style.backgroundColor = 'rgb(224, 224, 224)';
|
||||||
|
loadingScreen.style.zIndex = '1002';
|
||||||
|
loadingScreen.appendChild(images.logo);
|
||||||
|
loadingScreen.appendChild(images.loadingIcon);
|
||||||
|
// FF3.6 document.body can be undefined here
|
||||||
|
window.onload = function() {
|
||||||
|
document.body.style.margin = 0;
|
||||||
|
document.body.appendChild(loadingScreen);
|
||||||
|
startAnimation();
|
||||||
|
};
|
||||||
|
// IE8 does not call onload if already loaded before set
|
||||||
|
document.body && window.onload();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function startAnimation() {
|
||||||
|
var css, deg = 0, loadingIcon = document.getElementById('loadingIcon'),
|
||||||
|
previousTime = +new Date();
|
||||||
|
var animationInterval = setInterval(function() {
|
||||||
|
var currentTime = +new Date(),
|
||||||
|
delta = (currentTime - previousTime) / 1000;
|
||||||
|
previousTime = currentTime;
|
||||||
|
deg = Math.round((deg + delta * 360) % 360 / 30) * 30;
|
||||||
|
css = 'rotate(' + deg + 'deg)';
|
||||||
|
loadingIcon.style.MozTransform = css;
|
||||||
|
loadingIcon.style.MSTransform = css;
|
||||||
|
loadingIcon.style.OTransform = css;
|
||||||
|
loadingIcon.style.WebkitTransform = css;
|
||||||
|
loadingIcon.style.transform = css;
|
||||||
|
}, 83);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStatus() {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.onload = function() {
|
||||||
|
var response = JSON.parse(this.responseText);
|
||||||
|
if (response.step) {
|
||||||
|
var status = response.step;
|
||||||
|
if (response.progress) {
|
||||||
|
status = parseInt(response.progress * 100) + '% ' + status;
|
||||||
|
}
|
||||||
|
update.status.innerHTML = status;
|
||||||
|
setTimeout(updateStatus, 1000);
|
||||||
|
} else {
|
||||||
|
update.status.innerHTML = 'Relaunching...';
|
||||||
|
setTimeout(load, 500);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.onerror = function() {
|
||||||
|
var status = update.status.innerHTML;
|
||||||
|
if (['Relaunching...', ''].indexOf(status) == -1) {
|
||||||
|
update.status.innerHTML = 'Installation failed';
|
||||||
|
}
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
xhr.open('get', '/status');
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
}());
|
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
|
@ -0,0 +1,16 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256">
|
||||||
|
<g transform="translate(128, 128)" stroke="#808080" stroke-linecap="round" stroke-width="28">
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(0)" opacity="1"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(30)" opacity="0.083333"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(60)" opacity="0.166667"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(90)" opacity="0.25"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(120)" opacity="0.333333"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(150)" opacity="0.416667"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(180)" opacity="0.5"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(210)" opacity="0.583333"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(240)" opacity="0.666667"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(270)" opacity="0.75"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(300)" opacity="0.833333"/>
|
||||||
|
<line x1="0" y1="-114" x2="0" y2="-70" transform="rotate(330)" opacity="0.916667"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,270 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>files</key>
|
||||||
|
<dict>
|
||||||
|
<key>Resources/AppIcon.icns</key>
|
||||||
|
<data>
|
||||||
|
uJXVB1wchnMfESqlu15aymGkfzU=
|
||||||
|
</data>
|
||||||
|
<key>Resources/Assets.car</key>
|
||||||
|
<data>
|
||||||
|
J0bcbd6bu3teEBZKNEEQTcykNSI=
|
||||||
|
</data>
|
||||||
|
<key>Resources/Base.lproj/MainMenu.nib</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
wu5QbfHAcRte07MP8HrD2VGTxss=
|
||||||
|
</data>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/index.html</key>
|
||||||
|
<data>
|
||||||
|
JIBakF3URAgkk7dR8veswSN9zLI=
|
||||||
|
</data>
|
||||||
|
<key>Resources/install.html</key>
|
||||||
|
<data>
|
||||||
|
HSrvBNGr2ZorlpsVkPW8WhxHmJU=
|
||||||
|
</data>
|
||||||
|
<key>Resources/install.py</key>
|
||||||
|
<data>
|
||||||
|
8P8EjUEoWuHCRIRvQTi7vbDhGoM=
|
||||||
|
</data>
|
||||||
|
<key>Resources/js/install.js</key>
|
||||||
|
<data>
|
||||||
|
Vm6iTydoG1DWT+GNOLDV51fPEaA=
|
||||||
|
</data>
|
||||||
|
<key>Resources/png/oml.png</key>
|
||||||
|
<data>
|
||||||
|
yAW1cp8HHJoIRTYucCTGeG575vM=
|
||||||
|
</data>
|
||||||
|
<key>Resources/svg/symbolLoading.svg</key>
|
||||||
|
<data>
|
||||||
|
bp9z14AgWlNHFY+FF4dBnbl127s=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>files2</key>
|
||||||
|
<dict>
|
||||||
|
<key>Frameworks/libswiftAppKit.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
BfWCqDz3l/ei3lMoRHzUs0Faz1I=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"05f582a83cf797f7a2de5328447cd4b3415acf52"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftCore.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
KErlQnFHB1oAtlbBqagrepY0Pi0=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"284ae5427147075a00b656c1a9a82b7a96343e2d"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftCoreData.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
+qOGIC1K4Jw18cvmWMeAL/7vb30=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"faa386202d4ae09c35f1cbe658c7802ffeef6f7d"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftCoreGraphics.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
gMATYaSfUYMCuY6NOWxpSdXV0rc=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"80c01361a49f518302b98e8d396c6949d5d5d2b7"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftCoreImage.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
xmyuSLfv82vL65/t1QEU7z/DC48=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"c66cae48b7eff36bcbeb9fedd50114ef3fc30b8f"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftDarwin.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
TjFVRc30ZSuhgWSatSHtAUEyiqM=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"4e315545cdf4652ba181649ab521ed0141328aa3"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftDispatch.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
yBUpkqP7Wv2E7BLzAMjTMV5pPIU=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"c8152992a3fb5afd84ec12f300c8d3315e693c85"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftFoundation.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
sf16n9ERJGQqjYPT05wC3zeiItQ=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"b1fd7a9fd11124642a8d83d3d39c02df37a222d4"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Frameworks/libswiftObjectiveC.dylib</key>
|
||||||
|
<dict>
|
||||||
|
<key>cdhash</key>
|
||||||
|
<data>
|
||||||
|
4R3j0BKBovRFuiMv3qqfuODkyB8=
|
||||||
|
</data>
|
||||||
|
<key>requirement</key>
|
||||||
|
<string>cdhash H"e11de3d01281a2f445ba232fdeaa9fb8e0e4c81f"</string>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/AppIcon.icns</key>
|
||||||
|
<data>
|
||||||
|
uJXVB1wchnMfESqlu15aymGkfzU=
|
||||||
|
</data>
|
||||||
|
<key>Resources/Assets.car</key>
|
||||||
|
<data>
|
||||||
|
J0bcbd6bu3teEBZKNEEQTcykNSI=
|
||||||
|
</data>
|
||||||
|
<key>Resources/Base.lproj/MainMenu.nib</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
wu5QbfHAcRte07MP8HrD2VGTxss=
|
||||||
|
</data>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/index.html</key>
|
||||||
|
<data>
|
||||||
|
JIBakF3URAgkk7dR8veswSN9zLI=
|
||||||
|
</data>
|
||||||
|
<key>Resources/install.html</key>
|
||||||
|
<data>
|
||||||
|
HSrvBNGr2ZorlpsVkPW8WhxHmJU=
|
||||||
|
</data>
|
||||||
|
<key>Resources/install.py</key>
|
||||||
|
<data>
|
||||||
|
8P8EjUEoWuHCRIRvQTi7vbDhGoM=
|
||||||
|
</data>
|
||||||
|
<key>Resources/js/install.js</key>
|
||||||
|
<data>
|
||||||
|
Vm6iTydoG1DWT+GNOLDV51fPEaA=
|
||||||
|
</data>
|
||||||
|
<key>Resources/png/oml.png</key>
|
||||||
|
<data>
|
||||||
|
yAW1cp8HHJoIRTYucCTGeG575vM=
|
||||||
|
</data>
|
||||||
|
<key>Resources/svg/symbolLoading.svg</key>
|
||||||
|
<data>
|
||||||
|
bp9z14AgWlNHFY+FF4dBnbl127s=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>rules</key>
|
||||||
|
<dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version.plist$</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>rules2</key>
|
||||||
|
<dict>
|
||||||
|
<key>.*\.dSYM($|/)</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>11</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(.*/)?\.DS_Store$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>2000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Info\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^PkgInfo$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^[^/]+$</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^embedded\.provisionprofile$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
10
bin/pip3
Executable file
10
bin/pip3
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==7.1.2','console_scripts','pip3'
|
||||||
|
__requires__ = 'pip==7.1.2'
|
||||||
|
import sys
|
||||||
|
from pkg_resources import load_entry_point
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(
|
||||||
|
load_entry_point('pip==7.1.2', 'console_scripts', 'pip3')()
|
||||||
|
)
|
1
bin/python3
Symbolic link
1
bin/python3
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
python3.5
|
BIN
bin/python3.5
Executable file
BIN
bin/python3.5
Executable file
Binary file not shown.
600
include/python3.5m/Python-ast.h
Normal file
600
include/python3.5m/Python-ast.h
Normal file
|
@ -0,0 +1,600 @@
|
||||||
|
/* File automatically generated by Parser/asdl_c.py. */
|
||||||
|
|
||||||
|
#include "asdl.h"
|
||||||
|
|
||||||
|
typedef struct _mod *mod_ty;
|
||||||
|
|
||||||
|
typedef struct _stmt *stmt_ty;
|
||||||
|
|
||||||
|
typedef struct _expr *expr_ty;
|
||||||
|
|
||||||
|
typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5,
|
||||||
|
Param=6 } expr_context_ty;
|
||||||
|
|
||||||
|
typedef struct _slice *slice_ty;
|
||||||
|
|
||||||
|
typedef enum _boolop { And=1, Or=2 } boolop_ty;
|
||||||
|
|
||||||
|
typedef enum _operator { Add=1, Sub=2, Mult=3, MatMult=4, Div=5, Mod=6, Pow=7,
|
||||||
|
LShift=8, RShift=9, BitOr=10, BitXor=11, BitAnd=12,
|
||||||
|
FloorDiv=13 } operator_ty;
|
||||||
|
|
||||||
|
typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;
|
||||||
|
|
||||||
|
typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8,
|
||||||
|
In=9, NotIn=10 } cmpop_ty;
|
||||||
|
|
||||||
|
typedef struct _comprehension *comprehension_ty;
|
||||||
|
|
||||||
|
typedef struct _excepthandler *excepthandler_ty;
|
||||||
|
|
||||||
|
typedef struct _arguments *arguments_ty;
|
||||||
|
|
||||||
|
typedef struct _arg *arg_ty;
|
||||||
|
|
||||||
|
typedef struct _keyword *keyword_ty;
|
||||||
|
|
||||||
|
typedef struct _alias *alias_ty;
|
||||||
|
|
||||||
|
typedef struct _withitem *withitem_ty;
|
||||||
|
|
||||||
|
|
||||||
|
enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3,
|
||||||
|
Suite_kind=4};
|
||||||
|
struct _mod {
|
||||||
|
enum _mod_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
} Module;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
} Interactive;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty body;
|
||||||
|
} Expression;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
} Suite;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3,
|
||||||
|
Return_kind=4, Delete_kind=5, Assign_kind=6,
|
||||||
|
AugAssign_kind=7, For_kind=8, AsyncFor_kind=9, While_kind=10,
|
||||||
|
If_kind=11, With_kind=12, AsyncWith_kind=13, Raise_kind=14,
|
||||||
|
Try_kind=15, Assert_kind=16, Import_kind=17,
|
||||||
|
ImportFrom_kind=18, Global_kind=19, Nonlocal_kind=20,
|
||||||
|
Expr_kind=21, Pass_kind=22, Break_kind=23, Continue_kind=24};
|
||||||
|
struct _stmt {
|
||||||
|
enum _stmt_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
identifier name;
|
||||||
|
arguments_ty args;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *decorator_list;
|
||||||
|
expr_ty returns;
|
||||||
|
} FunctionDef;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier name;
|
||||||
|
arguments_ty args;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *decorator_list;
|
||||||
|
expr_ty returns;
|
||||||
|
} AsyncFunctionDef;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier name;
|
||||||
|
asdl_seq *bases;
|
||||||
|
asdl_seq *keywords;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *decorator_list;
|
||||||
|
} ClassDef;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Return;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *targets;
|
||||||
|
} Delete;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *targets;
|
||||||
|
expr_ty value;
|
||||||
|
} Assign;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty target;
|
||||||
|
operator_ty op;
|
||||||
|
expr_ty value;
|
||||||
|
} AugAssign;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty target;
|
||||||
|
expr_ty iter;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} For;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty target;
|
||||||
|
expr_ty iter;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} AsyncFor;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} While;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
} If;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *items;
|
||||||
|
asdl_seq *body;
|
||||||
|
} With;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *items;
|
||||||
|
asdl_seq *body;
|
||||||
|
} AsyncWith;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty exc;
|
||||||
|
expr_ty cause;
|
||||||
|
} Raise;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *body;
|
||||||
|
asdl_seq *handlers;
|
||||||
|
asdl_seq *orelse;
|
||||||
|
asdl_seq *finalbody;
|
||||||
|
} Try;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
expr_ty msg;
|
||||||
|
} Assert;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *names;
|
||||||
|
} Import;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier module;
|
||||||
|
asdl_seq *names;
|
||||||
|
int level;
|
||||||
|
} ImportFrom;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *names;
|
||||||
|
} Global;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *names;
|
||||||
|
} Nonlocal;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Expr;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
|
||||||
|
IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8,
|
||||||
|
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
|
||||||
|
Await_kind=12, Yield_kind=13, YieldFrom_kind=14,
|
||||||
|
Compare_kind=15, Call_kind=16, Num_kind=17, Str_kind=18,
|
||||||
|
Bytes_kind=19, NameConstant_kind=20, Ellipsis_kind=21,
|
||||||
|
Attribute_kind=22, Subscript_kind=23, Starred_kind=24,
|
||||||
|
Name_kind=25, List_kind=26, Tuple_kind=27};
|
||||||
|
struct _expr {
|
||||||
|
enum _expr_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
boolop_ty op;
|
||||||
|
asdl_seq *values;
|
||||||
|
} BoolOp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty left;
|
||||||
|
operator_ty op;
|
||||||
|
expr_ty right;
|
||||||
|
} BinOp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
unaryop_ty op;
|
||||||
|
expr_ty operand;
|
||||||
|
} UnaryOp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
arguments_ty args;
|
||||||
|
expr_ty body;
|
||||||
|
} Lambda;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty test;
|
||||||
|
expr_ty body;
|
||||||
|
expr_ty orelse;
|
||||||
|
} IfExp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *keys;
|
||||||
|
asdl_seq *values;
|
||||||
|
} Dict;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *elts;
|
||||||
|
} Set;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty elt;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} ListComp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty elt;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} SetComp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty key;
|
||||||
|
expr_ty value;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} DictComp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty elt;
|
||||||
|
asdl_seq *generators;
|
||||||
|
} GeneratorExp;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Await;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Yield;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} YieldFrom;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty left;
|
||||||
|
asdl_int_seq *ops;
|
||||||
|
asdl_seq *comparators;
|
||||||
|
} Compare;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty func;
|
||||||
|
asdl_seq *args;
|
||||||
|
asdl_seq *keywords;
|
||||||
|
} Call;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
object n;
|
||||||
|
} Num;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
string s;
|
||||||
|
} Str;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bytes s;
|
||||||
|
} Bytes;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
singleton value;
|
||||||
|
} NameConstant;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
identifier attr;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Attribute;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
slice_ty slice;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Subscript;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Starred;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
identifier id;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Name;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *elts;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} List;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *elts;
|
||||||
|
expr_context_ty ctx;
|
||||||
|
} Tuple;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3};
|
||||||
|
struct _slice {
|
||||||
|
enum _slice_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
expr_ty lower;
|
||||||
|
expr_ty upper;
|
||||||
|
expr_ty step;
|
||||||
|
} Slice;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
asdl_seq *dims;
|
||||||
|
} ExtSlice;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
expr_ty value;
|
||||||
|
} Index;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _comprehension {
|
||||||
|
expr_ty target;
|
||||||
|
expr_ty iter;
|
||||||
|
asdl_seq *ifs;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _excepthandler_kind {ExceptHandler_kind=1};
|
||||||
|
struct _excepthandler {
|
||||||
|
enum _excepthandler_kind kind;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
expr_ty type;
|
||||||
|
identifier name;
|
||||||
|
asdl_seq *body;
|
||||||
|
} ExceptHandler;
|
||||||
|
|
||||||
|
} v;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _arguments {
|
||||||
|
asdl_seq *args;
|
||||||
|
arg_ty vararg;
|
||||||
|
asdl_seq *kwonlyargs;
|
||||||
|
asdl_seq *kw_defaults;
|
||||||
|
arg_ty kwarg;
|
||||||
|
asdl_seq *defaults;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _arg {
|
||||||
|
identifier arg;
|
||||||
|
expr_ty annotation;
|
||||||
|
int lineno;
|
||||||
|
int col_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _keyword {
|
||||||
|
identifier arg;
|
||||||
|
expr_ty value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _alias {
|
||||||
|
identifier name;
|
||||||
|
identifier asname;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _withitem {
|
||||||
|
expr_ty context_expr;
|
||||||
|
expr_ty optional_vars;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define Module(a0, a1) _Py_Module(a0, a1)
|
||||||
|
mod_ty _Py_Module(asdl_seq * body, PyArena *arena);
|
||||||
|
#define Interactive(a0, a1) _Py_Interactive(a0, a1)
|
||||||
|
mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
|
||||||
|
#define Expression(a0, a1) _Py_Expression(a0, a1)
|
||||||
|
mod_ty _Py_Expression(expr_ty body, PyArena *arena);
|
||||||
|
#define Suite(a0, a1) _Py_Suite(a0, a1)
|
||||||
|
mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
|
||||||
|
#define FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6, a7)
|
||||||
|
stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
|
||||||
|
asdl_seq * decorator_list, expr_ty returns, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_AsyncFunctionDef(a0, a1, a2, a3, a4, a5, a6, a7)
|
||||||
|
stmt_ty _Py_AsyncFunctionDef(identifier name, arguments_ty args, asdl_seq *
|
||||||
|
body, asdl_seq * decorator_list, expr_ty returns,
|
||||||
|
int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define ClassDef(a0, a1, a2, a3, a4, a5, a6, a7) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6, a7)
|
||||||
|
stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords,
|
||||||
|
asdl_seq * body, asdl_seq * decorator_list, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
|
||||||
|
orelse, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define AsyncFor(a0, a1, a2, a3, a4, a5, a6) _Py_AsyncFor(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
stmt_ty _Py_AsyncFor(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
|
||||||
|
orelse, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
|
||||||
|
int col_offset, PyArena *arena);
|
||||||
|
#define With(a0, a1, a2, a3, a4) _Py_With(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_With(asdl_seq * items, asdl_seq * body, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define AsyncWith(a0, a1, a2, a3, a4) _Py_AsyncWith(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_AsyncWith(asdl_seq * items, asdl_seq * body, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Raise(a0, a1, a2, a3, a4) _Py_Raise(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Try(a0, a1, a2, a3, a4, a5, a6) _Py_Try(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
stmt_ty _Py_Try(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
|
||||||
|
asdl_seq * finalbody, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
|
||||||
|
stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5)
|
||||||
|
stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Nonlocal(a0, a1, a2, a3) _Py_Nonlocal(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3)
|
||||||
|
stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2)
|
||||||
|
stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Break(a0, a1, a2) _Py_Break(a0, a1, a2)
|
||||||
|
stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2)
|
||||||
|
stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
|
||||||
|
PyArena *arena);
|
||||||
|
#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Await(a0, a1, a2, a3) _Py_Await(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Await(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define YieldFrom(a0, a1, a2, a3) _Py_YieldFrom(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
|
||||||
|
int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Call(a0, a1, a2, a3, a4, a5) _Py_Call(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Bytes(a0, a1, a2, a3) _Py_Bytes(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_Bytes(bytes s, int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define NameConstant(a0, a1, a2, a3) _Py_NameConstant(a0, a1, a2, a3)
|
||||||
|
expr_ty _Py_NameConstant(singleton value, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define Ellipsis(a0, a1, a2) _Py_Ellipsis(a0, a1, a2)
|
||||||
|
expr_ty _Py_Ellipsis(int lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5)
|
||||||
|
expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
|
||||||
|
lineno, int col_offset, PyArena *arena);
|
||||||
|
#define Starred(a0, a1, a2, a3, a4) _Py_Starred(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Starred(expr_ty value, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4)
|
||||||
|
expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
|
||||||
|
col_offset, PyArena *arena);
|
||||||
|
#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3)
|
||||||
|
slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
|
||||||
|
#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1)
|
||||||
|
slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena);
|
||||||
|
#define Index(a0, a1) _Py_Index(a0, a1)
|
||||||
|
slice_ty _Py_Index(expr_ty value, PyArena *arena);
|
||||||
|
#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3)
|
||||||
|
comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
|
||||||
|
ifs, PyArena *arena);
|
||||||
|
#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5)
|
||||||
|
excepthandler_ty _Py_ExceptHandler(expr_ty type, identifier name, asdl_seq *
|
||||||
|
body, int lineno, int col_offset, PyArena
|
||||||
|
*arena);
|
||||||
|
#define arguments(a0, a1, a2, a3, a4, a5, a6) _Py_arguments(a0, a1, a2, a3, a4, a5, a6)
|
||||||
|
arguments_ty _Py_arguments(asdl_seq * args, arg_ty vararg, asdl_seq *
|
||||||
|
kwonlyargs, asdl_seq * kw_defaults, arg_ty kwarg,
|
||||||
|
asdl_seq * defaults, PyArena *arena);
|
||||||
|
#define arg(a0, a1, a2) _Py_arg(a0, a1, a2)
|
||||||
|
arg_ty _Py_arg(identifier arg, expr_ty annotation, PyArena *arena);
|
||||||
|
#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2)
|
||||||
|
keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena);
|
||||||
|
#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
|
||||||
|
alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena);
|
||||||
|
#define withitem(a0, a1, a2) _Py_withitem(a0, a1, a2)
|
||||||
|
withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena
|
||||||
|
*arena);
|
||||||
|
|
||||||
|
PyObject* PyAST_mod2obj(mod_ty t);
|
||||||
|
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
|
||||||
|
int PyAST_Check(PyObject* obj);
|
135
include/python3.5m/Python.h
Normal file
135
include/python3.5m/Python.h
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
#ifndef Py_PYTHON_H
|
||||||
|
#define Py_PYTHON_H
|
||||||
|
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
|
||||||
|
|
||||||
|
/* Include nearly all Python header files */
|
||||||
|
|
||||||
|
#include "patchlevel.h"
|
||||||
|
#include "pyconfig.h"
|
||||||
|
#include "pymacconfig.h"
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifndef UCHAR_MAX
|
||||||
|
#error "Something's broken. UCHAR_MAX should be defined in limits.h."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UCHAR_MAX != 255
|
||||||
|
#error "Python's source code assumes C's unsigned char is an 8-bit type."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
|
||||||
|
#define _SGI_MP_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifndef NULL
|
||||||
|
# error "Python.h requires that stdio.h define NULL."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For size_t? */
|
||||||
|
#ifdef HAVE_STDDEF_H
|
||||||
|
#include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CAUTION: Build setups should ensure that NDEBUG is defined on the
|
||||||
|
* compiler command line when building Python in release mode; else
|
||||||
|
* assert() calls won't be removed.
|
||||||
|
*/
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "pyport.h"
|
||||||
|
#include "pymacro.h"
|
||||||
|
|
||||||
|
#include "pyatomic.h"
|
||||||
|
|
||||||
|
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
|
||||||
|
* PYMALLOC_DEBUG is in error if pymalloc is not in use.
|
||||||
|
*/
|
||||||
|
#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
|
||||||
|
#define PYMALLOC_DEBUG
|
||||||
|
#endif
|
||||||
|
#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
|
||||||
|
#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
|
||||||
|
#endif
|
||||||
|
#include "pymath.h"
|
||||||
|
#include "pytime.h"
|
||||||
|
#include "pymem.h"
|
||||||
|
|
||||||
|
#include "object.h"
|
||||||
|
#include "objimpl.h"
|
||||||
|
#include "typeslots.h"
|
||||||
|
#include "pyhash.h"
|
||||||
|
|
||||||
|
#include "pydebug.h"
|
||||||
|
|
||||||
|
#include "bytearrayobject.h"
|
||||||
|
#include "bytesobject.h"
|
||||||
|
#include "unicodeobject.h"
|
||||||
|
#include "longobject.h"
|
||||||
|
#include "longintrepr.h"
|
||||||
|
#include "boolobject.h"
|
||||||
|
#include "floatobject.h"
|
||||||
|
#include "complexobject.h"
|
||||||
|
#include "rangeobject.h"
|
||||||
|
#include "memoryobject.h"
|
||||||
|
#include "tupleobject.h"
|
||||||
|
#include "listobject.h"
|
||||||
|
#include "dictobject.h"
|
||||||
|
#include "odictobject.h"
|
||||||
|
#include "enumobject.h"
|
||||||
|
#include "setobject.h"
|
||||||
|
#include "methodobject.h"
|
||||||
|
#include "moduleobject.h"
|
||||||
|
#include "funcobject.h"
|
||||||
|
#include "classobject.h"
|
||||||
|
#include "fileobject.h"
|
||||||
|
#include "pycapsule.h"
|
||||||
|
#include "traceback.h"
|
||||||
|
#include "sliceobject.h"
|
||||||
|
#include "cellobject.h"
|
||||||
|
#include "iterobject.h"
|
||||||
|
#include "genobject.h"
|
||||||
|
#include "descrobject.h"
|
||||||
|
#include "warnings.h"
|
||||||
|
#include "weakrefobject.h"
|
||||||
|
#include "structseq.h"
|
||||||
|
#include "namespaceobject.h"
|
||||||
|
|
||||||
|
#include "codecs.h"
|
||||||
|
#include "pyerrors.h"
|
||||||
|
|
||||||
|
#include "pystate.h"
|
||||||
|
|
||||||
|
#include "pyarena.h"
|
||||||
|
#include "modsupport.h"
|
||||||
|
#include "pythonrun.h"
|
||||||
|
#include "pylifecycle.h"
|
||||||
|
#include "ceval.h"
|
||||||
|
#include "sysmodule.h"
|
||||||
|
#include "intrcheck.h"
|
||||||
|
#include "import.h"
|
||||||
|
|
||||||
|
#include "abstract.h"
|
||||||
|
#include "bltinmodule.h"
|
||||||
|
|
||||||
|
#include "compile.h"
|
||||||
|
#include "eval.h"
|
||||||
|
|
||||||
|
#include "pyctype.h"
|
||||||
|
#include "pystrtod.h"
|
||||||
|
#include "pystrcmp.h"
|
||||||
|
#include "dtoa.h"
|
||||||
|
#include "fileutils.h"
|
||||||
|
#include "pyfpe.h"
|
||||||
|
|
||||||
|
#endif /* !Py_PYTHON_H */
|
1285
include/python3.5m/abstract.h
Normal file
1285
include/python3.5m/abstract.h
Normal file
File diff suppressed because it is too large
Load diff
37
include/python3.5m/accu.h
Normal file
37
include/python3.5m/accu.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_ACCU_H
|
||||||
|
#define Py_ACCU_H
|
||||||
|
|
||||||
|
/*** This is a private API for use by the interpreter and the stdlib.
|
||||||
|
*** Its definition may be changed or removed at any moment.
|
||||||
|
***/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A two-level accumulator of unicode objects that avoids both the overhead
|
||||||
|
* of keeping a huge number of small separate objects, and the quadratic
|
||||||
|
* behaviour of using a naive repeated concatenation scheme.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef small /* defined by some Windows headers */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject *large; /* A list of previously accumulated large strings */
|
||||||
|
PyObject *small; /* Pending small strings */
|
||||||
|
} _PyAccu;
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc);
|
||||||
|
PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc);
|
||||||
|
PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Py_ACCU_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
45
include/python3.5m/asdl.h
Normal file
45
include/python3.5m/asdl.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#ifndef Py_ASDL_H
|
||||||
|
#define Py_ASDL_H
|
||||||
|
|
||||||
|
typedef PyObject * identifier;
|
||||||
|
typedef PyObject * string;
|
||||||
|
typedef PyObject * bytes;
|
||||||
|
typedef PyObject * object;
|
||||||
|
typedef PyObject * singleton;
|
||||||
|
|
||||||
|
/* It would be nice if the code generated by asdl_c.py was completely
|
||||||
|
independent of Python, but it is a goal the requires too much work
|
||||||
|
at this stage. So, for example, I'll represent identifiers as
|
||||||
|
interned Python strings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* XXX A sequence should be typed so that its use can be typechecked. */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Py_ssize_t size;
|
||||||
|
void *elements[1];
|
||||||
|
} asdl_seq;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Py_ssize_t size;
|
||||||
|
int elements[1];
|
||||||
|
} asdl_int_seq;
|
||||||
|
|
||||||
|
asdl_seq *_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena);
|
||||||
|
asdl_int_seq *_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
|
||||||
|
|
||||||
|
#define asdl_seq_GET(S, I) (S)->elements[(I)]
|
||||||
|
#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)
|
||||||
|
#ifdef Py_DEBUG
|
||||||
|
#define asdl_seq_SET(S, I, V) \
|
||||||
|
do { \
|
||||||
|
Py_ssize_t _asdl_i = (I); \
|
||||||
|
assert((S) != NULL); \
|
||||||
|
assert(_asdl_i < (S)->size); \
|
||||||
|
(S)->elements[_asdl_i] = (V); \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_ASDL_H */
|
22
include/python3.5m/ast.h
Normal file
22
include/python3.5m/ast.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef Py_AST_H
|
||||||
|
#define Py_AST_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
|
||||||
|
PyAPI_FUNC(mod_ty) PyAST_FromNode(
|
||||||
|
const node *n,
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
PyArena *arena);
|
||||||
|
PyAPI_FUNC(mod_ty) PyAST_FromNodeObject(
|
||||||
|
const node *n,
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
PyObject *filename,
|
||||||
|
PyArena *arena);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_AST_H */
|
32
include/python3.5m/bitset.h
Normal file
32
include/python3.5m/bitset.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
#ifndef Py_BITSET_H
|
||||||
|
#define Py_BITSET_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Bitset interface */
|
||||||
|
|
||||||
|
#define BYTE char
|
||||||
|
|
||||||
|
typedef BYTE *bitset;
|
||||||
|
|
||||||
|
bitset newbitset(int nbits);
|
||||||
|
void delbitset(bitset bs);
|
||||||
|
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
|
||||||
|
int addbit(bitset bs, int ibit); /* Returns 0 if already set */
|
||||||
|
int samebitset(bitset bs1, bitset bs2, int nbits);
|
||||||
|
void mergebitset(bitset bs1, bitset bs2, int nbits);
|
||||||
|
|
||||||
|
#define BITSPERBYTE (8*sizeof(BYTE))
|
||||||
|
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
|
||||||
|
|
||||||
|
#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
|
||||||
|
#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
|
||||||
|
#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
|
||||||
|
#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BITSET_H */
|
14
include/python3.5m/bltinmodule.h
Normal file
14
include/python3.5m/bltinmodule.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef Py_BLTINMODULE_H
|
||||||
|
#define Py_BLTINMODULE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFilter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMap_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyZip_Type;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BLTINMODULE_H */
|
34
include/python3.5m/boolobject.h
Normal file
34
include/python3.5m/boolobject.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* Boolean object interface */
|
||||||
|
|
||||||
|
#ifndef Py_BOOLOBJECT_H
|
||||||
|
#define Py_BOOLOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyBool_Type;
|
||||||
|
|
||||||
|
#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
|
||||||
|
|
||||||
|
/* Py_False and Py_True are the only two bools in existence.
|
||||||
|
Don't forget to apply Py_INCREF() when returning either!!! */
|
||||||
|
|
||||||
|
/* Don't use these directly */
|
||||||
|
PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
|
||||||
|
|
||||||
|
/* Use these macros */
|
||||||
|
#define Py_False ((PyObject *) &_Py_FalseStruct)
|
||||||
|
#define Py_True ((PyObject *) &_Py_TrueStruct)
|
||||||
|
|
||||||
|
/* Macros for returning Py_True or Py_False, respectively */
|
||||||
|
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
|
||||||
|
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
|
||||||
|
|
||||||
|
/* Function to return a bool from a C long */
|
||||||
|
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BOOLOBJECT_H */
|
62
include/python3.5m/bytearrayobject.h
Normal file
62
include/python3.5m/bytearrayobject.h
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/* ByteArray object interface */
|
||||||
|
|
||||||
|
#ifndef Py_BYTEARRAYOBJECT_H
|
||||||
|
#define Py_BYTEARRAYOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/* Type PyByteArrayObject represents a mutable array of bytes.
|
||||||
|
* The Python API is that of a sequence;
|
||||||
|
* the bytes are mapped to ints in [0, 256).
|
||||||
|
* Bytes are not characters; they may be used to encode characters.
|
||||||
|
* The only way to go between bytes and str/unicode is via encoding
|
||||||
|
* and decoding.
|
||||||
|
* For the convenience of C programmers, the bytes type is considered
|
||||||
|
* to contain a char pointer, not an unsigned char pointer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Object layout */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */
|
||||||
|
char *ob_bytes; /* Physical backing buffer */
|
||||||
|
char *ob_start; /* Logical start inside ob_bytes */
|
||||||
|
/* XXX(nnorwitz): should ob_exports be Py_ssize_t? */
|
||||||
|
int ob_exports; /* How many buffer exports */
|
||||||
|
} PyByteArrayObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Type object */
|
||||||
|
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
|
||||||
|
|
||||||
|
/* Type check macros */
|
||||||
|
#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
|
||||||
|
#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type)
|
||||||
|
|
||||||
|
/* Direct API functions */
|
||||||
|
PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *);
|
||||||
|
PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
|
||||||
|
|
||||||
|
/* Macros, trading safety for speed */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyByteArray_AS_STRING(self) \
|
||||||
|
(assert(PyByteArray_Check(self)), \
|
||||||
|
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string)
|
||||||
|
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self))
|
||||||
|
|
||||||
|
PyAPI_DATA(char) _PyByteArray_empty_string[];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BYTEARRAYOBJECT_H */
|
46
include/python3.5m/bytes_methods.h
Normal file
46
include/python3.5m/bytes_methods.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_BYTES_CTYPE_H
|
||||||
|
#define Py_BYTES_CTYPE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The internal implementation behind PyBytes (bytes) and PyByteArray (bytearray)
|
||||||
|
* methods of the given names, they operate on ASCII byte strings.
|
||||||
|
*/
|
||||||
|
extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
|
||||||
|
extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
|
||||||
|
|
||||||
|
/* These store their len sized answer in the given preallocated *result arg. */
|
||||||
|
extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
|
||||||
|
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
|
||||||
|
|
||||||
|
/* The maketrans() static method. */
|
||||||
|
extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to);
|
||||||
|
|
||||||
|
/* Shared __doc__ strings. */
|
||||||
|
extern const char _Py_isspace__doc__[];
|
||||||
|
extern const char _Py_isalpha__doc__[];
|
||||||
|
extern const char _Py_isalnum__doc__[];
|
||||||
|
extern const char _Py_isdigit__doc__[];
|
||||||
|
extern const char _Py_islower__doc__[];
|
||||||
|
extern const char _Py_isupper__doc__[];
|
||||||
|
extern const char _Py_istitle__doc__[];
|
||||||
|
extern const char _Py_lower__doc__[];
|
||||||
|
extern const char _Py_upper__doc__[];
|
||||||
|
extern const char _Py_title__doc__[];
|
||||||
|
extern const char _Py_capitalize__doc__[];
|
||||||
|
extern const char _Py_swapcase__doc__[];
|
||||||
|
extern const char _Py_maketrans__doc__[];
|
||||||
|
|
||||||
|
/* this is needed because some docs are shared from the .o, not static */
|
||||||
|
#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
|
||||||
|
|
||||||
|
#endif /* !Py_BYTES_CTYPE_H */
|
||||||
|
#endif /* !Py_LIMITED_API */
|
129
include/python3.5m/bytesobject.h
Normal file
129
include/python3.5m/bytesobject.h
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
|
||||||
|
/* Bytes (String) object interface */
|
||||||
|
|
||||||
|
#ifndef Py_BYTESOBJECT_H
|
||||||
|
#define Py_BYTESOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Type PyBytesObject represents a character string. An extra zero byte is
|
||||||
|
reserved at the end to ensure it is zero-terminated, but a size is
|
||||||
|
present so strings with null bytes in them can be represented. This
|
||||||
|
is an immutable object type.
|
||||||
|
|
||||||
|
There are functions to create new string objects, to test
|
||||||
|
an object for string-ness, and to get the
|
||||||
|
string value. The latter function returns a null pointer
|
||||||
|
if the object is not of the proper type.
|
||||||
|
There is a variant that takes an explicit size as well as a
|
||||||
|
variant that assumes a zero-terminated string. Note that none of the
|
||||||
|
functions should be applied to nil objects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
|
||||||
|
This significantly speeds up dict lookups. */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
Py_hash_t ob_shash;
|
||||||
|
char ob_sval[1];
|
||||||
|
|
||||||
|
/* Invariants:
|
||||||
|
* ob_sval contains space for 'ob_size+1' elements.
|
||||||
|
* ob_sval[ob_size] == 0.
|
||||||
|
* ob_shash is the hash of the string or -1 if not computed yet.
|
||||||
|
*/
|
||||||
|
} PyBytesObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyBytes_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
|
||||||
|
|
||||||
|
#define PyBytes_Check(op) \
|
||||||
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
|
||||||
|
#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
|
||||||
|
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
|
||||||
|
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyBytes_Format(PyObject *, PyObject *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
|
||||||
|
const char *, Py_ssize_t,
|
||||||
|
const char *);
|
||||||
|
|
||||||
|
/* Macro, trading safety for speed */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
|
||||||
|
(((PyBytesObject *)(op))->ob_sval))
|
||||||
|
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
|
||||||
|
x must be an iterable object. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Provides access to the internal data buffer and size of a string
|
||||||
|
object or the default encoded version of an Unicode object. Passing
|
||||||
|
NULL as *len parameter will force the string buffer to be
|
||||||
|
0-terminated (passing a string with embedded NULL characters will
|
||||||
|
cause an exception). */
|
||||||
|
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
|
||||||
|
PyObject *obj, /* string or Unicode object */
|
||||||
|
char **s, /* pointer to buffer variable */
|
||||||
|
Py_ssize_t *len /* pointer to length variable or NULL
|
||||||
|
(only possible for 0-terminated
|
||||||
|
strings) */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Using the current locale, insert the thousands grouping
|
||||||
|
into the string pointed to by buffer. For the argument descriptions,
|
||||||
|
see Objects/stringlib/localeutil.h */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
|
||||||
|
Py_ssize_t n_buffer,
|
||||||
|
char *digits,
|
||||||
|
Py_ssize_t n_digits,
|
||||||
|
Py_ssize_t min_width);
|
||||||
|
|
||||||
|
/* Using explicit passed-in values, insert the thousands grouping
|
||||||
|
into the string pointed to by buffer. For the argument descriptions,
|
||||||
|
see Objects/stringlib/localeutil.h */
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
|
||||||
|
Py_ssize_t n_buffer,
|
||||||
|
char *digits,
|
||||||
|
Py_ssize_t n_digits,
|
||||||
|
Py_ssize_t min_width,
|
||||||
|
const char *grouping,
|
||||||
|
const char *thousands_sep);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flags used by string formatting */
|
||||||
|
#define F_LJUST (1<<0)
|
||||||
|
#define F_SIGN (1<<1)
|
||||||
|
#define F_BLANK (1<<2)
|
||||||
|
#define F_ALT (1<<3)
|
||||||
|
#define F_ZERO (1<<4)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_BYTESOBJECT_H */
|
29
include/python3.5m/cellobject.h
Normal file
29
include/python3.5m/cellobject.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/* Cell object interface */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_CELLOBJECT_H
|
||||||
|
#define Py_CELLOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject *ob_ref; /* Content of the cell or NULL when empty */
|
||||||
|
} PyCellObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCell_Type;
|
||||||
|
|
||||||
|
#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref)
|
||||||
|
#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_TUPLEOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
207
include/python3.5m/ceval.h
Normal file
207
include/python3.5m/ceval.h
Normal file
|
@ -0,0 +1,207 @@
|
||||||
|
#ifndef Py_CEVAL_H
|
||||||
|
#define Py_CEVAL_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Interface to random parts in ceval.c */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
|
||||||
|
PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
/* Inline this */
|
||||||
|
#define PyEval_CallObject(func,arg) \
|
||||||
|
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
|
||||||
|
const char *format, ...);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
|
||||||
|
const char *methodname,
|
||||||
|
const char *format, ...);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
|
||||||
|
PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct _frame; /* Avoid including frameobject.h */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
|
||||||
|
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
|
||||||
|
|
||||||
|
/* Look at the current frame's (if any) code's co_flags, and turn on
|
||||||
|
the corresponding compiler flags in cf->cf_flags. Return 1 if any
|
||||||
|
flag was set, else return 0. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
|
||||||
|
PyAPI_FUNC(int) Py_MakePendingCalls(void);
|
||||||
|
|
||||||
|
/* Protection against deeply nested recursive calls
|
||||||
|
|
||||||
|
In Python 3.0, this protection has two levels:
|
||||||
|
* normal anti-recursion protection is triggered when the recursion level
|
||||||
|
exceeds the current recursion limit. It raises a RecursionError, and sets
|
||||||
|
the "overflowed" flag in the thread state structure. This flag
|
||||||
|
temporarily *disables* the normal protection; this allows cleanup code
|
||||||
|
to potentially outgrow the recursion limit while processing the
|
||||||
|
RecursionError.
|
||||||
|
* "last chance" anti-recursion protection is triggered when the recursion
|
||||||
|
level exceeds "current recursion limit + 50". By construction, this
|
||||||
|
protection can only be triggered when the "overflowed" flag is set. It
|
||||||
|
means the cleanup code has itself gone into an infinite loop, or the
|
||||||
|
RecursionError has been mistakingly ignored. When this protection is
|
||||||
|
triggered, the interpreter aborts with a Fatal Error.
|
||||||
|
|
||||||
|
In addition, the "overflowed" flag is automatically reset when the
|
||||||
|
recursion level drops below "current recursion limit - 50". This heuristic
|
||||||
|
is meant to ensure that the normal anti-recursion protection doesn't get
|
||||||
|
disabled too long.
|
||||||
|
|
||||||
|
Please note: this scheme has its own limitations. See:
|
||||||
|
http://mail.python.org/pipermail/python-dev/2008-August/082106.html
|
||||||
|
for some observations.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(void) Py_SetRecursionLimit(int);
|
||||||
|
PyAPI_FUNC(int) Py_GetRecursionLimit(void);
|
||||||
|
|
||||||
|
#define Py_EnterRecursiveCall(where) \
|
||||||
|
(_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
|
||||||
|
_Py_CheckRecursiveCall(where))
|
||||||
|
#define Py_LeaveRecursiveCall() \
|
||||||
|
do{ if(_Py_MakeEndRecCheck(PyThreadState_GET()->recursion_depth)) \
|
||||||
|
PyThreadState_GET()->overflowed = 0; \
|
||||||
|
} while(0)
|
||||||
|
PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where);
|
||||||
|
PyAPI_DATA(int) _Py_CheckRecursionLimit;
|
||||||
|
|
||||||
|
#ifdef USE_STACKCHECK
|
||||||
|
/* With USE_STACKCHECK, we artificially decrement the recursion limit in order
|
||||||
|
to trigger regular stack checks in _Py_CheckRecursiveCall(), except if
|
||||||
|
the "overflowed" flag is set, in which case we need the true value
|
||||||
|
of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function properly.
|
||||||
|
*/
|
||||||
|
# define _Py_MakeRecCheck(x) \
|
||||||
|
(++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 1))
|
||||||
|
#else
|
||||||
|
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _Py_MakeEndRecCheck(x) \
|
||||||
|
(--(x) < ((_Py_CheckRecursionLimit > 100) \
|
||||||
|
? (_Py_CheckRecursionLimit - 50) \
|
||||||
|
: (3 * (_Py_CheckRecursionLimit >> 2))))
|
||||||
|
|
||||||
|
#define Py_ALLOW_RECURSION \
|
||||||
|
do { unsigned char _old = PyThreadState_GET()->recursion_critical;\
|
||||||
|
PyThreadState_GET()->recursion_critical = 1;
|
||||||
|
|
||||||
|
#define Py_END_ALLOW_RECURSION \
|
||||||
|
PyThreadState_GET()->recursion_critical = _old; \
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
|
||||||
|
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
|
||||||
|
|
||||||
|
/* Interface for threads.
|
||||||
|
|
||||||
|
A module that plans to do a blocking system call (or something else
|
||||||
|
that lasts a long time and doesn't touch Python data) can allow other
|
||||||
|
threads to run as follows:
|
||||||
|
|
||||||
|
...preparations here...
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
...blocking system call here...
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
|
...interpret result here...
|
||||||
|
|
||||||
|
The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
|
||||||
|
{}-surrounded block.
|
||||||
|
To leave the block in the middle (e.g., with return), you must insert
|
||||||
|
a line containing Py_BLOCK_THREADS before the return, e.g.
|
||||||
|
|
||||||
|
if (...premature_exit...) {
|
||||||
|
Py_BLOCK_THREADS
|
||||||
|
PyErr_SetFromErrno(PyExc_IOError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
An alternative is:
|
||||||
|
|
||||||
|
Py_BLOCK_THREADS
|
||||||
|
if (...premature_exit...) {
|
||||||
|
PyErr_SetFromErrno(PyExc_IOError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Py_UNBLOCK_THREADS
|
||||||
|
|
||||||
|
For convenience, that the value of 'errno' is restored across
|
||||||
|
Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
|
||||||
|
|
||||||
|
WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
|
||||||
|
Py_END_ALLOW_THREADS!!!
|
||||||
|
|
||||||
|
The function PyEval_InitThreads() should be called only from
|
||||||
|
init_thread() in "_threadmodule.c".
|
||||||
|
|
||||||
|
Note that not yet all candidates have been converted to use this
|
||||||
|
mechanism!
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
|
||||||
|
|
||||||
|
#ifdef WITH_THREAD
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_InitThreads(void);
|
||||||
|
PyAPI_FUNC(void) _PyEval_FiniThreads(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_AcquireLock(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_ReleaseLock(void);
|
||||||
|
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
|
||||||
|
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
|
||||||
|
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
|
||||||
|
PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Py_BEGIN_ALLOW_THREADS { \
|
||||||
|
PyThreadState *_save; \
|
||||||
|
_save = PyEval_SaveThread();
|
||||||
|
#define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
|
||||||
|
#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
|
||||||
|
#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !WITH_THREAD */
|
||||||
|
|
||||||
|
#define Py_BEGIN_ALLOW_THREADS {
|
||||||
|
#define Py_BLOCK_THREADS
|
||||||
|
#define Py_UNBLOCK_THREADS
|
||||||
|
#define Py_END_ALLOW_THREADS }
|
||||||
|
|
||||||
|
#endif /* !WITH_THREAD */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
|
||||||
|
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CEVAL_H */
|
58
include/python3.5m/classobject.h
Normal file
58
include/python3.5m/classobject.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* Former class object interface -- now only bound methods are here */
|
||||||
|
|
||||||
|
/* Revealing some structures (not for general use) */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_CLASSOBJECT_H
|
||||||
|
#define Py_CLASSOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject *im_func; /* The callable object implementing the method */
|
||||||
|
PyObject *im_self; /* The instance it is bound to */
|
||||||
|
PyObject *im_weakreflist; /* List of weak references */
|
||||||
|
} PyMethodObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMethod_Type;
|
||||||
|
|
||||||
|
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
||||||
|
|
||||||
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
|
done, so use with care. */
|
||||||
|
#define PyMethod_GET_FUNCTION(meth) \
|
||||||
|
(((PyMethodObject *)meth) -> im_func)
|
||||||
|
#define PyMethod_GET_SELF(meth) \
|
||||||
|
(((PyMethodObject *)meth) -> im_self)
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject *func;
|
||||||
|
} PyInstanceMethodObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
|
||||||
|
|
||||||
|
#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
|
||||||
|
|
||||||
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
|
done, so use with care. */
|
||||||
|
#define PyInstanceMethod_GET_FUNCTION(meth) \
|
||||||
|
(((PyInstanceMethodObject *)meth) -> func)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CLASSOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
126
include/python3.5m/code.h
Normal file
126
include/python3.5m/code.h
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
/* Definitions for bytecode */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_CODE_H
|
||||||
|
#define Py_CODE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Bytecode object */
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
int co_argcount; /* #arguments, except *args */
|
||||||
|
int co_kwonlyargcount; /* #keyword only arguments */
|
||||||
|
int co_nlocals; /* #local variables */
|
||||||
|
int co_stacksize; /* #entries needed for evaluation stack */
|
||||||
|
int co_flags; /* CO_..., see below */
|
||||||
|
PyObject *co_code; /* instruction opcodes */
|
||||||
|
PyObject *co_consts; /* list (constants used) */
|
||||||
|
PyObject *co_names; /* list of strings (names used) */
|
||||||
|
PyObject *co_varnames; /* tuple of strings (local variable names) */
|
||||||
|
PyObject *co_freevars; /* tuple of strings (free variable names) */
|
||||||
|
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
|
||||||
|
/* The rest aren't used in either hash or comparisons, except for
|
||||||
|
co_name (used in both) and co_firstlineno (used only in
|
||||||
|
comparisons). This is done to preserve the name and line number
|
||||||
|
for tracebacks and debuggers; otherwise, constant de-duplication
|
||||||
|
would collapse identical functions/lambdas defined on different lines.
|
||||||
|
*/
|
||||||
|
unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */
|
||||||
|
PyObject *co_filename; /* unicode (where it was loaded from) */
|
||||||
|
PyObject *co_name; /* unicode (name, for reference) */
|
||||||
|
int co_firstlineno; /* first source line number */
|
||||||
|
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See
|
||||||
|
Objects/lnotab_notes.txt for details. */
|
||||||
|
void *co_zombieframe; /* for optimization only (see frameobject.c) */
|
||||||
|
PyObject *co_weakreflist; /* to support weakrefs to code objects */
|
||||||
|
} PyCodeObject;
|
||||||
|
|
||||||
|
/* Masks for co_flags above */
|
||||||
|
#define CO_OPTIMIZED 0x0001
|
||||||
|
#define CO_NEWLOCALS 0x0002
|
||||||
|
#define CO_VARARGS 0x0004
|
||||||
|
#define CO_VARKEYWORDS 0x0008
|
||||||
|
#define CO_NESTED 0x0010
|
||||||
|
#define CO_GENERATOR 0x0020
|
||||||
|
/* The CO_NOFREE flag is set if there are no free or cell variables.
|
||||||
|
This information is redundant, but it allows a single flag test
|
||||||
|
to determine whether there is any extra work to be done when the
|
||||||
|
call frame it setup.
|
||||||
|
*/
|
||||||
|
#define CO_NOFREE 0x0040
|
||||||
|
|
||||||
|
/* The CO_COROUTINE flag is set for coroutine functions (defined with
|
||||||
|
``async def`` keywords) */
|
||||||
|
#define CO_COROUTINE 0x0080
|
||||||
|
#define CO_ITERABLE_COROUTINE 0x0100
|
||||||
|
|
||||||
|
/* These are no longer used. */
|
||||||
|
#if 0
|
||||||
|
#define CO_GENERATOR_ALLOWED 0x1000
|
||||||
|
#endif
|
||||||
|
#define CO_FUTURE_DIVISION 0x2000
|
||||||
|
#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */
|
||||||
|
#define CO_FUTURE_WITH_STATEMENT 0x8000
|
||||||
|
#define CO_FUTURE_PRINT_FUNCTION 0x10000
|
||||||
|
#define CO_FUTURE_UNICODE_LITERALS 0x20000
|
||||||
|
|
||||||
|
#define CO_FUTURE_BARRY_AS_BDFL 0x40000
|
||||||
|
#define CO_FUTURE_GENERATOR_STOP 0x80000
|
||||||
|
|
||||||
|
/* This value is found in the co_cell2arg array when the associated cell
|
||||||
|
variable does not correspond to an argument. The maximum number of
|
||||||
|
arguments is 255 (indexed up to 254), so 255 work as a special flag.*/
|
||||||
|
#define CO_CELL_NOT_AN_ARG 255
|
||||||
|
|
||||||
|
/* This should be defined if a future statement modifies the syntax.
|
||||||
|
For example, when a keyword is added.
|
||||||
|
*/
|
||||||
|
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
|
||||||
|
|
||||||
|
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCode_Type;
|
||||||
|
|
||||||
|
#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type)
|
||||||
|
#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))
|
||||||
|
|
||||||
|
/* Public interface */
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyCode_New(
|
||||||
|
int, int, int, int, int, PyObject *, PyObject *,
|
||||||
|
PyObject *, PyObject *, PyObject *, PyObject *,
|
||||||
|
PyObject *, PyObject *, int, PyObject *);
|
||||||
|
/* same as struct above */
|
||||||
|
|
||||||
|
/* Creates a new empty code object with the specified source location. */
|
||||||
|
PyAPI_FUNC(PyCodeObject *)
|
||||||
|
PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
|
||||||
|
|
||||||
|
/* Return the line number associated with the specified bytecode index
|
||||||
|
in this code object. If you just need the line number of a frame,
|
||||||
|
use PyFrame_GetLineNumber() instead. */
|
||||||
|
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
|
||||||
|
|
||||||
|
/* for internal use only */
|
||||||
|
typedef struct _addr_pair {
|
||||||
|
int ap_lower;
|
||||||
|
int ap_upper;
|
||||||
|
} PyAddrPair;
|
||||||
|
|
||||||
|
/* Update *bounds to describe the first and one-past-the-last instructions in the
|
||||||
|
same line as lasti. Return the number of that line.
|
||||||
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
|
||||||
|
int lasti, PyAddrPair *bounds);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
|
||||||
|
PyObject *names, PyObject *lineno_obj);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CODE_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
236
include/python3.5m/codecs.h
Normal file
236
include/python3.5m/codecs.h
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
#ifndef Py_CODECREGISTRY_H
|
||||||
|
#define Py_CODECREGISTRY_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Python Codec Registry and support functions
|
||||||
|
|
||||||
|
|
||||||
|
Written by Marc-Andre Lemburg (mal@lemburg.com).
|
||||||
|
|
||||||
|
Copyright (c) Corporation for National Research Initiatives.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/* Register a new codec search function.
|
||||||
|
|
||||||
|
As side effect, this tries to load the encodings package, if not
|
||||||
|
yet done, to make sure that it is always first in the list of
|
||||||
|
search functions.
|
||||||
|
|
||||||
|
The search_function's refcount is incremented by this function. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCodec_Register(
|
||||||
|
PyObject *search_function
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Codec registry lookup API.
|
||||||
|
|
||||||
|
Looks up the given encoding and returns a CodecInfo object with
|
||||||
|
function attributes which implement the different aspects of
|
||||||
|
processing the encoding.
|
||||||
|
|
||||||
|
The encoding string is looked up converted to all lower-case
|
||||||
|
characters. This makes encodings looked up through this mechanism
|
||||||
|
effectively case-insensitive.
|
||||||
|
|
||||||
|
If no codec is found, a KeyError is set and NULL returned.
|
||||||
|
|
||||||
|
As side effect, this tries to load the encodings package, if not
|
||||||
|
yet done. This is part of the lazy load strategy for the encodings
|
||||||
|
package.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
||||||
|
const char *encoding
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _PyCodec_Forget(
|
||||||
|
const char *encoding
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Codec registry encoding check API.
|
||||||
|
|
||||||
|
Returns 1/0 depending on whether there is a registered codec for
|
||||||
|
the given encoding.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCodec_KnownEncoding(
|
||||||
|
const char *encoding
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Generic codec based encoding API.
|
||||||
|
|
||||||
|
object is passed through the encoder function found for the given
|
||||||
|
encoding using the error handling method defined by errors. errors
|
||||||
|
may be NULL to use the default method defined for the codec.
|
||||||
|
|
||||||
|
Raises a LookupError in case no encoder can be found.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_Encode(
|
||||||
|
PyObject *object,
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Generic codec based decoding API.
|
||||||
|
|
||||||
|
object is passed through the decoder function found for the given
|
||||||
|
encoding using the error handling method defined by errors. errors
|
||||||
|
may be NULL to use the default method defined for the codec.
|
||||||
|
|
||||||
|
Raises a LookupError in case no encoder can be found.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
||||||
|
PyObject *object,
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* Text codec specific encoding and decoding API.
|
||||||
|
|
||||||
|
Checks the encoding against a list of codecs which do not
|
||||||
|
implement a str<->bytes encoding before attempting the
|
||||||
|
operation.
|
||||||
|
|
||||||
|
Please note that these APIs are internal and should not
|
||||||
|
be used in Python C extensions.
|
||||||
|
|
||||||
|
XXX (ncoghlan): should we make these, or something like them, public
|
||||||
|
in Python 3.5+?
|
||||||
|
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
|
||||||
|
const char *encoding,
|
||||||
|
const char *alternate_command
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
|
||||||
|
PyObject *object,
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
|
||||||
|
PyObject *object,
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
|
||||||
|
* is the only current API consumer.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
|
||||||
|
PyObject *codec_info,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
|
||||||
|
PyObject *codec_info,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* --- Codec Lookup APIs --------------------------------------------------
|
||||||
|
|
||||||
|
All APIs return a codec object with incremented refcount and are
|
||||||
|
based on _PyCodec_Lookup(). The same comments w/r to the encoding
|
||||||
|
name also apply to these APIs.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Get an encoder function for the given encoding. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_Encoder(
|
||||||
|
const char *encoding
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Get a decoder function for the given encoding. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_Decoder(
|
||||||
|
const char *encoding
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Get a IncrementalEncoder object for the given encoding. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Get a IncrementalDecoder object function for the given encoding. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
|
||||||
|
const char *encoding,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Get a StreamReader factory function for the given encoding. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
|
||||||
|
const char *encoding,
|
||||||
|
PyObject *stream,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Get a StreamWriter factory function for the given encoding. */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
|
||||||
|
const char *encoding,
|
||||||
|
PyObject *stream,
|
||||||
|
const char *errors
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Unicode encoding error handling callback registry API */
|
||||||
|
|
||||||
|
/* Register the error handling callback function error under the given
|
||||||
|
name. This function will be called by the codec when it encounters
|
||||||
|
unencodable characters/undecodable bytes and doesn't know the
|
||||||
|
callback name, when name is specified as the error parameter
|
||||||
|
in the call to the encode/decode function.
|
||||||
|
Return 0 on success, -1 on error */
|
||||||
|
PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
|
||||||
|
|
||||||
|
/* Lookup the error handling callback function registered under the given
|
||||||
|
name. As a special case NULL can be passed, in which case
|
||||||
|
the error handling callback for "strict" will be returned. */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
|
||||||
|
|
||||||
|
/* raise exc as an exception */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
|
||||||
|
|
||||||
|
/* ignore the unicode error, skipping the faulty input */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
|
||||||
|
|
||||||
|
/* replace the unicode encode error with ? or U+FFFD */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
|
||||||
|
|
||||||
|
/* replace the unicode encode error with XML character references */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
|
||||||
|
|
||||||
|
/* replace the unicode encode error with backslash escapes (\x, \u and \U) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
|
||||||
|
|
||||||
|
/* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc);
|
||||||
|
|
||||||
|
PyAPI_DATA(const char *) Py_hexdigits;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CODECREGISTRY_H */
|
73
include/python3.5m/compile.h
Normal file
73
include/python3.5m/compile.h
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#ifndef Py_COMPILE_H
|
||||||
|
#define Py_COMPILE_H
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#include "code.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Public interface */
|
||||||
|
struct _node; /* Declare the existence of this type */
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
|
||||||
|
|
||||||
|
/* Future feature support */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ff_features; /* flags set by future statements */
|
||||||
|
int ff_lineno; /* line number of last future statement */
|
||||||
|
} PyFutureFeatures;
|
||||||
|
|
||||||
|
#define FUTURE_NESTED_SCOPES "nested_scopes"
|
||||||
|
#define FUTURE_GENERATORS "generators"
|
||||||
|
#define FUTURE_DIVISION "division"
|
||||||
|
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
|
||||||
|
#define FUTURE_WITH_STATEMENT "with_statement"
|
||||||
|
#define FUTURE_PRINT_FUNCTION "print_function"
|
||||||
|
#define FUTURE_UNICODE_LITERALS "unicode_literals"
|
||||||
|
#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
|
||||||
|
#define FUTURE_GENERATOR_STOP "generator_stop"
|
||||||
|
|
||||||
|
struct _mod; /* Declare the existence of this type */
|
||||||
|
#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
|
||||||
|
struct _mod *mod,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
int optimize,
|
||||||
|
PyArena *arena);
|
||||||
|
PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
|
||||||
|
struct _mod *mod,
|
||||||
|
PyObject *filename,
|
||||||
|
PyCompilerFlags *flags,
|
||||||
|
int optimize,
|
||||||
|
PyArena *arena);
|
||||||
|
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
|
||||||
|
struct _mod * mod,
|
||||||
|
const char *filename /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
|
||||||
|
struct _mod * mod,
|
||||||
|
PyObject *filename
|
||||||
|
);
|
||||||
|
|
||||||
|
/* _Py_Mangle is defined in compile.c */
|
||||||
|
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
|
||||||
|
|
||||||
|
#define PY_INVALID_STACK_EFFECT INT_MAX
|
||||||
|
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* These definitions must match corresponding definitions in graminit.h.
|
||||||
|
There's code in compile.c that checks that they are the same. */
|
||||||
|
#define Py_single_input 256
|
||||||
|
#define Py_file_input 257
|
||||||
|
#define Py_eval_input 258
|
||||||
|
|
||||||
|
#endif /* !Py_COMPILE_H */
|
69
include/python3.5m/complexobject.h
Normal file
69
include/python3.5m/complexobject.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/* Complex number structure */
|
||||||
|
|
||||||
|
#ifndef Py_COMPLEXOBJECT_H
|
||||||
|
#define Py_COMPLEXOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
double real;
|
||||||
|
double imag;
|
||||||
|
} Py_complex;
|
||||||
|
|
||||||
|
/* Operations on complex numbers from complexmodule.c */
|
||||||
|
|
||||||
|
PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
|
||||||
|
PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
|
||||||
|
PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
|
||||||
|
PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
|
||||||
|
PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
|
||||||
|
PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
|
||||||
|
PyAPI_FUNC(double) _Py_c_abs(Py_complex);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Complex object interface */
|
||||||
|
|
||||||
|
/*
|
||||||
|
PyComplexObject represents a complex number with double-precision
|
||||||
|
real and imaginary parts.
|
||||||
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
Py_complex cval;
|
||||||
|
} PyComplexObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyComplex_Type;
|
||||||
|
|
||||||
|
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
|
||||||
|
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
|
||||||
|
|
||||||
|
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
|
||||||
|
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||||
|
(Advanced String Formatting). */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter(
|
||||||
|
_PyUnicodeWriter *writer,
|
||||||
|
PyObject *obj,
|
||||||
|
PyObject *format_spec,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_COMPLEXOBJECT_H */
|
243
include/python3.5m/datetime.h
Normal file
243
include/python3.5m/datetime.h
Normal file
|
@ -0,0 +1,243 @@
|
||||||
|
/* datetime.h
|
||||||
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef DATETIME_H
|
||||||
|
#define DATETIME_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Fields are packed into successive bytes, each viewed as unsigned and
|
||||||
|
* big-endian, unless otherwise noted:
|
||||||
|
*
|
||||||
|
* byte offset
|
||||||
|
* 0 year 2 bytes, 1-9999
|
||||||
|
* 2 month 1 byte, 1-12
|
||||||
|
* 3 day 1 byte, 1-31
|
||||||
|
* 4 hour 1 byte, 0-23
|
||||||
|
* 5 minute 1 byte, 0-59
|
||||||
|
* 6 second 1 byte, 0-59
|
||||||
|
* 7 usecond 3 bytes, 0-999999
|
||||||
|
* 10
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* # of bytes for year, month, and day. */
|
||||||
|
#define _PyDateTime_DATE_DATASIZE 4
|
||||||
|
|
||||||
|
/* # of bytes for hour, minute, second, and usecond. */
|
||||||
|
#define _PyDateTime_TIME_DATASIZE 6
|
||||||
|
|
||||||
|
/* # of bytes for year, month, day, hour, minute, second, and usecond. */
|
||||||
|
#define _PyDateTime_DATETIME_DATASIZE 10
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PyObject_HEAD
|
||||||
|
Py_hash_t hashcode; /* -1 when unknown */
|
||||||
|
int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
|
||||||
|
int seconds; /* 0 <= seconds < 24*3600 is invariant */
|
||||||
|
int microseconds; /* 0 <= microseconds < 1000000 is invariant */
|
||||||
|
} PyDateTime_Delta;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
PyObject_HEAD /* a pure abstract base class */
|
||||||
|
} PyDateTime_TZInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/* The datetime and time types have hashcodes, and an optional tzinfo member,
|
||||||
|
* present if and only if hastzinfo is true.
|
||||||
|
*/
|
||||||
|
#define _PyTZINFO_HEAD \
|
||||||
|
PyObject_HEAD \
|
||||||
|
Py_hash_t hashcode; \
|
||||||
|
char hastzinfo; /* boolean flag */
|
||||||
|
|
||||||
|
/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something
|
||||||
|
* convenient to cast to, when getting at the hastzinfo member of objects
|
||||||
|
* starting with _PyTZINFO_HEAD.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
_PyTZINFO_HEAD
|
||||||
|
} _PyDateTime_BaseTZInfo;
|
||||||
|
|
||||||
|
/* All time objects are of PyDateTime_TimeType, but that can be allocated
|
||||||
|
* in two ways, with or without a tzinfo member. Without is the same as
|
||||||
|
* tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an
|
||||||
|
* internal struct used to allocate the right amount of space for the
|
||||||
|
* "without" case.
|
||||||
|
*/
|
||||||
|
#define _PyDateTime_TIMEHEAD \
|
||||||
|
_PyTZINFO_HEAD \
|
||||||
|
unsigned char data[_PyDateTime_TIME_DATASIZE];
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
_PyDateTime_TIMEHEAD
|
||||||
|
} _PyDateTime_BaseTime; /* hastzinfo false */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
_PyDateTime_TIMEHEAD
|
||||||
|
PyObject *tzinfo;
|
||||||
|
} PyDateTime_Time; /* hastzinfo true */
|
||||||
|
|
||||||
|
|
||||||
|
/* All datetime objects are of PyDateTime_DateTimeType, but that can be
|
||||||
|
* allocated in two ways too, just like for time objects above. In addition,
|
||||||
|
* the plain date type is a base class for datetime, so it must also have
|
||||||
|
* a hastzinfo member (although it's unused there).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
_PyTZINFO_HEAD
|
||||||
|
unsigned char data[_PyDateTime_DATE_DATASIZE];
|
||||||
|
} PyDateTime_Date;
|
||||||
|
|
||||||
|
#define _PyDateTime_DATETIMEHEAD \
|
||||||
|
_PyTZINFO_HEAD \
|
||||||
|
unsigned char data[_PyDateTime_DATETIME_DATASIZE];
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
_PyDateTime_DATETIMEHEAD
|
||||||
|
} _PyDateTime_BaseDateTime; /* hastzinfo false */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
_PyDateTime_DATETIMEHEAD
|
||||||
|
PyObject *tzinfo;
|
||||||
|
} PyDateTime_DateTime; /* hastzinfo true */
|
||||||
|
|
||||||
|
|
||||||
|
/* Apply for date and datetime instances. */
|
||||||
|
#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \
|
||||||
|
((PyDateTime_Date*)o)->data[1])
|
||||||
|
#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2])
|
||||||
|
#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3])
|
||||||
|
|
||||||
|
#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4])
|
||||||
|
#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5])
|
||||||
|
#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6])
|
||||||
|
#define PyDateTime_DATE_GET_MICROSECOND(o) \
|
||||||
|
((((PyDateTime_DateTime*)o)->data[7] << 16) | \
|
||||||
|
(((PyDateTime_DateTime*)o)->data[8] << 8) | \
|
||||||
|
((PyDateTime_DateTime*)o)->data[9])
|
||||||
|
|
||||||
|
/* Apply for time instances. */
|
||||||
|
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
|
||||||
|
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
|
||||||
|
#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
|
||||||
|
#define PyDateTime_TIME_GET_MICROSECOND(o) \
|
||||||
|
((((PyDateTime_Time*)o)->data[3] << 16) | \
|
||||||
|
(((PyDateTime_Time*)o)->data[4] << 8) | \
|
||||||
|
((PyDateTime_Time*)o)->data[5])
|
||||||
|
|
||||||
|
/* Apply for time delta instances */
|
||||||
|
#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days)
|
||||||
|
#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds)
|
||||||
|
#define PyDateTime_DELTA_GET_MICROSECONDS(o) \
|
||||||
|
(((PyDateTime_Delta*)o)->microseconds)
|
||||||
|
|
||||||
|
|
||||||
|
/* Define structure for C API. */
|
||||||
|
typedef struct {
|
||||||
|
/* type objects */
|
||||||
|
PyTypeObject *DateType;
|
||||||
|
PyTypeObject *DateTimeType;
|
||||||
|
PyTypeObject *TimeType;
|
||||||
|
PyTypeObject *DeltaType;
|
||||||
|
PyTypeObject *TZInfoType;
|
||||||
|
|
||||||
|
/* constructors */
|
||||||
|
PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*);
|
||||||
|
PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int,
|
||||||
|
PyObject*, PyTypeObject*);
|
||||||
|
PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*);
|
||||||
|
PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*);
|
||||||
|
|
||||||
|
/* constructors for the DB API */
|
||||||
|
PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*);
|
||||||
|
PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*);
|
||||||
|
|
||||||
|
} PyDateTime_CAPI;
|
||||||
|
|
||||||
|
#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Py_BUILD_CORE
|
||||||
|
|
||||||
|
/* Macros for type checking when building the Python core. */
|
||||||
|
#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType)
|
||||||
|
#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType)
|
||||||
|
|
||||||
|
#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
|
||||||
|
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType)
|
||||||
|
|
||||||
|
#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
|
||||||
|
#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType)
|
||||||
|
|
||||||
|
#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
|
||||||
|
#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType)
|
||||||
|
|
||||||
|
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
|
||||||
|
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Define global variable for the C API and a macro for setting it. */
|
||||||
|
static PyDateTime_CAPI *PyDateTimeAPI = NULL;
|
||||||
|
|
||||||
|
#define PyDateTime_IMPORT \
|
||||||
|
PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)
|
||||||
|
|
||||||
|
/* Macros for type checking when not building the Python core. */
|
||||||
|
#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
|
||||||
|
#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType)
|
||||||
|
|
||||||
|
#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
|
||||||
|
#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType)
|
||||||
|
|
||||||
|
#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
|
||||||
|
#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType)
|
||||||
|
|
||||||
|
#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
|
||||||
|
#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType)
|
||||||
|
|
||||||
|
#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
|
||||||
|
#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType)
|
||||||
|
|
||||||
|
/* Macros for accessing constructors in a simplified fashion. */
|
||||||
|
#define PyDate_FromDate(year, month, day) \
|
||||||
|
PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType)
|
||||||
|
|
||||||
|
#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \
|
||||||
|
PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
|
||||||
|
min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType)
|
||||||
|
|
||||||
|
#define PyTime_FromTime(hour, minute, second, usecond) \
|
||||||
|
PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
|
||||||
|
Py_None, PyDateTimeAPI->TimeType)
|
||||||
|
|
||||||
|
#define PyDelta_FromDSU(days, seconds, useconds) \
|
||||||
|
PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \
|
||||||
|
PyDateTimeAPI->DeltaType)
|
||||||
|
|
||||||
|
/* Macros supporting the DB API. */
|
||||||
|
#define PyDateTime_FromTimestamp(args) \
|
||||||
|
PyDateTimeAPI->DateTime_FromTimestamp( \
|
||||||
|
(PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL)
|
||||||
|
|
||||||
|
#define PyDate_FromTimestamp(args) \
|
||||||
|
PyDateTimeAPI->Date_FromTimestamp( \
|
||||||
|
(PyObject*) (PyDateTimeAPI->DateType), args)
|
||||||
|
|
||||||
|
#endif /* Py_BUILD_CORE */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_LIMITED_API */
|
105
include/python3.5m/descrobject.h
Normal file
105
include/python3.5m/descrobject.h
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/* Descriptors */
|
||||||
|
#ifndef Py_DESCROBJECT_H
|
||||||
|
#define Py_DESCROBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef PyObject *(*getter)(PyObject *, void *);
|
||||||
|
typedef int (*setter)(PyObject *, PyObject *, void *);
|
||||||
|
|
||||||
|
typedef struct PyGetSetDef {
|
||||||
|
char *name;
|
||||||
|
getter get;
|
||||||
|
setter set;
|
||||||
|
char *doc;
|
||||||
|
void *closure;
|
||||||
|
} PyGetSetDef;
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
|
||||||
|
void *wrapped);
|
||||||
|
|
||||||
|
typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
|
||||||
|
void *wrapped, PyObject *kwds);
|
||||||
|
|
||||||
|
struct wrapperbase {
|
||||||
|
char *name;
|
||||||
|
int offset;
|
||||||
|
void *function;
|
||||||
|
wrapperfunc wrapper;
|
||||||
|
char *doc;
|
||||||
|
int flags;
|
||||||
|
PyObject *name_strobj;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Flags for above struct */
|
||||||
|
#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
|
||||||
|
|
||||||
|
/* Various kinds of descriptor objects */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyTypeObject *d_type;
|
||||||
|
PyObject *d_name;
|
||||||
|
PyObject *d_qualname;
|
||||||
|
} PyDescrObject;
|
||||||
|
|
||||||
|
#define PyDescr_COMMON PyDescrObject d_common
|
||||||
|
|
||||||
|
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
||||||
|
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyDescr_COMMON;
|
||||||
|
PyMethodDef *d_method;
|
||||||
|
} PyMethodDescrObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyDescr_COMMON;
|
||||||
|
struct PyMemberDef *d_member;
|
||||||
|
} PyMemberDescrObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyDescr_COMMON;
|
||||||
|
PyGetSetDef *d_getset;
|
||||||
|
} PyGetSetDescrObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyDescr_COMMON;
|
||||||
|
struct wrapperbase *d_base;
|
||||||
|
void *d_wrapped; /* This can be any function pointer */
|
||||||
|
} PyWrapperDescrObject;
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type;
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
|
||||||
|
struct PyMemberDef; /* forward declaration for following prototype */
|
||||||
|
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
|
||||||
|
struct PyMemberDef *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
||||||
|
struct PyGetSetDef *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
||||||
|
struct wrapperbase *, void *);
|
||||||
|
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyProperty_Type;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_DESCROBJECT_H */
|
||||||
|
|
147
include/python3.5m/dictobject.h
Normal file
147
include/python3.5m/dictobject.h
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
#ifndef Py_DICTOBJECT_H
|
||||||
|
#define Py_DICTOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Dictionary object type -- mapping from hashable object to object */
|
||||||
|
|
||||||
|
/* The distribution includes a separate file, Objects/dictnotes.txt,
|
||||||
|
describing explorations into dictionary design and optimization.
|
||||||
|
It covers typical dictionary use patterns, the parameters for
|
||||||
|
tuning dictionaries, and several ideas for possible optimizations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
|
||||||
|
typedef struct _dictkeysobject PyDictKeysObject;
|
||||||
|
|
||||||
|
/* The ma_values pointer is NULL for a combined table
|
||||||
|
* or points to an array of PyObject* for a split table
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
Py_ssize_t ma_used;
|
||||||
|
PyDictKeysObject *ma_keys;
|
||||||
|
PyObject **ma_values;
|
||||||
|
} PyDictObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyDictObject *dv_dict;
|
||||||
|
} _PyDictViewObject;
|
||||||
|
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDict_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictItems_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
|
||||||
|
|
||||||
|
#define PyDict_Check(op) \
|
||||||
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
|
||||||
|
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
|
||||||
|
#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type)
|
||||||
|
#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type)
|
||||||
|
#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type)
|
||||||
|
/* This excludes Values, since they are not sets. */
|
||||||
|
# define PyDictViewSet_Check(op) \
|
||||||
|
(PyDictKeys_Check(op) || PyDictItems_Check(op))
|
||||||
|
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_New(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
|
||||||
|
Py_hash_t hash);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
|
||||||
|
struct _Py_Identifier *key);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
|
||||||
|
PyObject *mp, PyObject *key, PyObject *defaultobj);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key,
|
||||||
|
PyObject *item, Py_hash_t hash);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
|
||||||
|
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
|
||||||
|
PyAPI_FUNC(int) PyDict_Next(
|
||||||
|
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyDictKeysObject *_PyDict_NewKeysForClass(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
|
||||||
|
PyAPI_FUNC(int) _PyDict_Next(
|
||||||
|
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
|
||||||
|
PyObject *_PyDictView_New(PyObject *, PyTypeObject *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
|
||||||
|
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
||||||
|
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
||||||
|
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
||||||
|
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
|
||||||
|
PyObject *_PyDict_SizeOf(PyDictObject *);
|
||||||
|
PyObject *_PyDict_Pop(PyDictObject *, PyObject *, PyObject *);
|
||||||
|
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
|
||||||
|
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyDict_ClearFreeList(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
|
||||||
|
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
|
||||||
|
|
||||||
|
/* PyDict_Merge updates/merges from a mapping object (an object that
|
||||||
|
supports PyMapping_Keys() and PyObject_GetItem()). If override is true,
|
||||||
|
the last occurrence of a key wins, else the first. The Python
|
||||||
|
dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
|
||||||
|
PyObject *other,
|
||||||
|
int override);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
|
||||||
|
iterable objects of length 2. If override is true, the last occurrence
|
||||||
|
of a key wins, else the first. The Python dict constructor dict(seq2)
|
||||||
|
is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
|
||||||
|
PyObject *seq2,
|
||||||
|
int override);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key);
|
||||||
|
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
|
||||||
|
PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
|
||||||
|
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
|
||||||
|
PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
|
||||||
|
|
||||||
|
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
|
||||||
|
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_DICTOBJECT_H */
|
19
include/python3.5m/dtoa.h
Normal file
19
include/python3.5m/dtoa.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef PY_NO_SHORT_FLOAT_REPR
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
|
||||||
|
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
|
||||||
|
int *decpt, int *sign, char **rve);
|
||||||
|
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
|
||||||
|
PyAPI_FUNC(double) _Py_dg_stdnan(int sign);
|
||||||
|
PyAPI_FUNC(double) _Py_dg_infinity(int sign);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
499
include/python3.5m/dynamic_annotations.h
Normal file
499
include/python3.5m/dynamic_annotations.h
Normal file
|
@ -0,0 +1,499 @@
|
||||||
|
/* Copyright (c) 2008-2009, Google Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Neither the name of Google Inc. nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ---
|
||||||
|
* Author: Kostya Serebryany
|
||||||
|
* Copied to CPython by Jeffrey Yasskin, with all macros renamed to
|
||||||
|
* start with _Py_ to avoid colliding with users embedding Python, and
|
||||||
|
* with deprecated macros removed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This file defines dynamic annotations for use with dynamic analysis
|
||||||
|
tool such as valgrind, PIN, etc.
|
||||||
|
|
||||||
|
Dynamic annotation is a source code annotation that affects
|
||||||
|
the generated code (that is, the annotation is not a comment).
|
||||||
|
Each such annotation is attached to a particular
|
||||||
|
instruction and/or to a particular object (address) in the program.
|
||||||
|
|
||||||
|
The annotations that should be used by users are macros in all upper-case
|
||||||
|
(e.g., _Py_ANNOTATE_NEW_MEMORY).
|
||||||
|
|
||||||
|
Actual implementation of these macros may differ depending on the
|
||||||
|
dynamic analysis tool being used.
|
||||||
|
|
||||||
|
See http://code.google.com/p/data-race-test/ for more information.
|
||||||
|
|
||||||
|
This file supports the following dynamic analysis tools:
|
||||||
|
- None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero).
|
||||||
|
Macros are defined empty.
|
||||||
|
- ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1).
|
||||||
|
Macros are defined as calls to non-inlinable empty functions
|
||||||
|
that are intercepted by Valgrind. */
|
||||||
|
|
||||||
|
#ifndef __DYNAMIC_ANNOTATIONS_H__
|
||||||
|
#define __DYNAMIC_ANNOTATIONS_H__
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_ANNOTATIONS_ENABLED
|
||||||
|
# define DYNAMIC_ANNOTATIONS_ENABLED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DYNAMIC_ANNOTATIONS_ENABLED != 0
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when implementing condition variables such as CondVar,
|
||||||
|
using conditional critical sections (Await/LockWhen) and when constructing
|
||||||
|
user-defined synchronization mechanisms.
|
||||||
|
|
||||||
|
The annotations _Py_ANNOTATE_HAPPENS_BEFORE() and
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER() can be used to define happens-before arcs in
|
||||||
|
user-defined synchronization mechanisms: the race detector will infer an
|
||||||
|
arc from the former to the latter when they share the same argument
|
||||||
|
pointer.
|
||||||
|
|
||||||
|
Example 1 (reference counting):
|
||||||
|
|
||||||
|
void Unref() {
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE(&refcount_);
|
||||||
|
if (AtomicDecrementByOne(&refcount_) == 0) {
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER(&refcount_);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Example 2 (message queue):
|
||||||
|
|
||||||
|
void MyQueue::Put(Type *e) {
|
||||||
|
MutexLock lock(&mu_);
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE(e);
|
||||||
|
PutElementIntoMyQueue(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type *MyQueue::Get() {
|
||||||
|
MutexLock lock(&mu_);
|
||||||
|
Type *e = GetElementFromMyQueue();
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER(e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
Note: when possible, please use the existing reference counting and message
|
||||||
|
queue implementations instead of inventing new ones. */
|
||||||
|
|
||||||
|
/* Report that wait on the condition variable at address "cv" has succeeded
|
||||||
|
and the lock at address "lock" is held. */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \
|
||||||
|
AnnotateCondVarWait(__FILE__, __LINE__, cv, lock)
|
||||||
|
|
||||||
|
/* Report that wait on the condition variable at "cv" has succeeded. Variant
|
||||||
|
w/o lock. */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_WAIT(cv) \
|
||||||
|
AnnotateCondVarWait(__FILE__, __LINE__, cv, NULL)
|
||||||
|
|
||||||
|
/* Report that we are about to signal on the condition variable at address
|
||||||
|
"cv". */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) \
|
||||||
|
AnnotateCondVarSignal(__FILE__, __LINE__, cv)
|
||||||
|
|
||||||
|
/* Report that we are about to signal_all on the condition variable at "cv". */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \
|
||||||
|
AnnotateCondVarSignalAll(__FILE__, __LINE__, cv)
|
||||||
|
|
||||||
|
/* Annotations for user-defined synchronization mechanisms. */
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) _Py_ANNOTATE_CONDVAR_SIGNAL(obj)
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_AFTER(obj) _Py_ANNOTATE_CONDVAR_WAIT(obj)
|
||||||
|
|
||||||
|
/* Report that the bytes in the range [pointer, pointer+size) are about
|
||||||
|
to be published safely. The race checker will create a happens-before
|
||||||
|
arc from the call _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) to
|
||||||
|
subsequent accesses to this memory.
|
||||||
|
Note: this annotation may not work properly if the race detector uses
|
||||||
|
sampling, i.e. does not observe all memory accesses.
|
||||||
|
*/
|
||||||
|
#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \
|
||||||
|
AnnotatePublishMemoryRange(__FILE__, __LINE__, pointer, size)
|
||||||
|
|
||||||
|
/* Instruct the tool to create a happens-before arc between mu->Unlock() and
|
||||||
|
mu->Lock(). This annotation may slow down the race detector and hide real
|
||||||
|
races. Normally it is used only when it would be difficult to annotate each
|
||||||
|
of the mutex's critical sections individually using the annotations above.
|
||||||
|
This annotation makes sense only for hybrid race detectors. For pure
|
||||||
|
happens-before detectors this is a no-op. For more details see
|
||||||
|
http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */
|
||||||
|
#define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \
|
||||||
|
AnnotateMutexIsUsedAsCondVar(__FILE__, __LINE__, mu)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when defining memory allocators, or when memory that
|
||||||
|
was protected in one way starts to be protected in another. */
|
||||||
|
|
||||||
|
/* Report that a new memory at "address" of size "size" has been allocated.
|
||||||
|
This might be used when the memory has been retrieved from a free list and
|
||||||
|
is about to be reused, or when the locking discipline for a variable
|
||||||
|
changes. */
|
||||||
|
#define _Py_ANNOTATE_NEW_MEMORY(address, size) \
|
||||||
|
AnnotateNewMemory(__FILE__, __LINE__, address, size)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when defining FIFO queues that transfer data between
|
||||||
|
threads. */
|
||||||
|
|
||||||
|
/* Report that the producer-consumer queue (such as ProducerConsumerQueue) at
|
||||||
|
address "pcq" has been created. The _Py_ANNOTATE_PCQ_* annotations should
|
||||||
|
be used only for FIFO queues. For non-FIFO queues use
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE (for put) and _Py_ANNOTATE_HAPPENS_AFTER (for
|
||||||
|
get). */
|
||||||
|
#define _Py_ANNOTATE_PCQ_CREATE(pcq) \
|
||||||
|
AnnotatePCQCreate(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* Report that the queue at address "pcq" is about to be destroyed. */
|
||||||
|
#define _Py_ANNOTATE_PCQ_DESTROY(pcq) \
|
||||||
|
AnnotatePCQDestroy(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* Report that we are about to put an element into a FIFO queue at address
|
||||||
|
"pcq". */
|
||||||
|
#define _Py_ANNOTATE_PCQ_PUT(pcq) \
|
||||||
|
AnnotatePCQPut(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* Report that we've just got an element from a FIFO queue at address "pcq". */
|
||||||
|
#define _Py_ANNOTATE_PCQ_GET(pcq) \
|
||||||
|
AnnotatePCQGet(__FILE__, __LINE__, pcq)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations that suppress errors. It is usually better to express the
|
||||||
|
program's synchronization using the other annotations, but these can
|
||||||
|
be used when all else fails. */
|
||||||
|
|
||||||
|
/* Report that we may have a benign race at "pointer", with size
|
||||||
|
"sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the
|
||||||
|
point where "pointer" has been allocated, preferably close to the point
|
||||||
|
where the race happens. See also _Py_ANNOTATE_BENIGN_RACE_STATIC. */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE(pointer, description) \
|
||||||
|
AnnotateBenignRaceSized(__FILE__, __LINE__, pointer, \
|
||||||
|
sizeof(*(pointer)), description)
|
||||||
|
|
||||||
|
/* Same as _Py_ANNOTATE_BENIGN_RACE(address, description), but applies to
|
||||||
|
the memory range [address, address+size). */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \
|
||||||
|
AnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description)
|
||||||
|
|
||||||
|
/* Request the analysis tool to ignore all reads in the current thread
|
||||||
|
until _Py_ANNOTATE_IGNORE_READS_END is called.
|
||||||
|
Useful to ignore intentional racey reads, while still checking
|
||||||
|
other reads and all writes.
|
||||||
|
See also _Py_ANNOTATE_UNPROTECTED_READ. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_BEGIN() \
|
||||||
|
AnnotateIgnoreReadsBegin(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Stop ignoring reads. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_END() \
|
||||||
|
AnnotateIgnoreReadsEnd(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() \
|
||||||
|
AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Stop ignoring writes. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_END() \
|
||||||
|
AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Start ignoring all memory accesses (reads and writes). */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \
|
||||||
|
do {\
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN();\
|
||||||
|
_Py_ANNOTATE_IGNORE_WRITES_BEGIN();\
|
||||||
|
}while(0)\
|
||||||
|
|
||||||
|
/* Stop ignoring all memory accesses. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() \
|
||||||
|
do {\
|
||||||
|
_Py_ANNOTATE_IGNORE_WRITES_END();\
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END();\
|
||||||
|
}while(0)\
|
||||||
|
|
||||||
|
/* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events:
|
||||||
|
RWLOCK* and CONDVAR*. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() \
|
||||||
|
AnnotateIgnoreSyncBegin(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Stop ignoring sync events. */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_END() \
|
||||||
|
AnnotateIgnoreSyncEnd(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
|
/* Enable (enable!=0) or disable (enable==0) race detection for all threads.
|
||||||
|
This annotation could be useful if you want to skip expensive race analysis
|
||||||
|
during some period of program execution, e.g. during initialization. */
|
||||||
|
#define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) \
|
||||||
|
AnnotateEnableRaceDetection(__FILE__, __LINE__, enable)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful for debugging. */
|
||||||
|
|
||||||
|
/* Request to trace every access to "address". */
|
||||||
|
#define _Py_ANNOTATE_TRACE_MEMORY(address) \
|
||||||
|
AnnotateTraceMemory(__FILE__, __LINE__, address)
|
||||||
|
|
||||||
|
/* Report the current thread name to a race detector. */
|
||||||
|
#define _Py_ANNOTATE_THREAD_NAME(name) \
|
||||||
|
AnnotateThreadName(__FILE__, __LINE__, name)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when implementing locks. They are not
|
||||||
|
normally needed by modules that merely use locks.
|
||||||
|
The "lock" argument is a pointer to the lock object. */
|
||||||
|
|
||||||
|
/* Report that a lock has been created at address "lock". */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_CREATE(lock) \
|
||||||
|
AnnotateRWLockCreate(__FILE__, __LINE__, lock)
|
||||||
|
|
||||||
|
/* Report that the lock at address "lock" is about to be destroyed. */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_DESTROY(lock) \
|
||||||
|
AnnotateRWLockDestroy(__FILE__, __LINE__, lock)
|
||||||
|
|
||||||
|
/* Report that the lock at address "lock" has been acquired.
|
||||||
|
is_w=1 for writer lock, is_w=0 for reader lock. */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \
|
||||||
|
AnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w)
|
||||||
|
|
||||||
|
/* Report that the lock at address "lock" is about to be released. */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) \
|
||||||
|
AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful when implementing barriers. They are not
|
||||||
|
normally needed by modules that merely use barriers.
|
||||||
|
The "barrier" argument is a pointer to the barrier object. */
|
||||||
|
|
||||||
|
/* Report that the "barrier" has been initialized with initial "count".
|
||||||
|
If 'reinitialization_allowed' is true, initialization is allowed to happen
|
||||||
|
multiple times w/o calling barrier_destroy() */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \
|
||||||
|
AnnotateBarrierInit(__FILE__, __LINE__, barrier, count, \
|
||||||
|
reinitialization_allowed)
|
||||||
|
|
||||||
|
/* Report that we are about to enter barrier_wait("barrier"). */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \
|
||||||
|
AnnotateBarrierWaitBefore(__FILE__, __LINE__, barrier)
|
||||||
|
|
||||||
|
/* Report that we just exited barrier_wait("barrier"). */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) \
|
||||||
|
AnnotateBarrierWaitAfter(__FILE__, __LINE__, barrier)
|
||||||
|
|
||||||
|
/* Report that the "barrier" has been destroyed. */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_DESTROY(barrier) \
|
||||||
|
AnnotateBarrierDestroy(__FILE__, __LINE__, barrier)
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------
|
||||||
|
Annotations useful for testing race detectors. */
|
||||||
|
|
||||||
|
/* Report that we expect a race on the variable at "address".
|
||||||
|
Use only in unit tests for a race detector. */
|
||||||
|
#define _Py_ANNOTATE_EXPECT_RACE(address, description) \
|
||||||
|
AnnotateExpectRace(__FILE__, __LINE__, address, description)
|
||||||
|
|
||||||
|
/* A no-op. Insert where you like to test the interceptors. */
|
||||||
|
#define _Py_ANNOTATE_NO_OP(arg) \
|
||||||
|
AnnotateNoOp(__FILE__, __LINE__, arg)
|
||||||
|
|
||||||
|
/* Force the race detector to flush its state. The actual effect depends on
|
||||||
|
* the implementation of the detector. */
|
||||||
|
#define _Py_ANNOTATE_FLUSH_STATE() \
|
||||||
|
AnnotateFlushState(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
|
#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
|
||||||
|
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_CREATE(lock) /* empty */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_DESTROY(lock) /* empty */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */
|
||||||
|
#define _Py_ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) /* */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BARRIER_DESTROY(barrier) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_WAIT(cv) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */
|
||||||
|
#define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
|
||||||
|
#define _Py_ANNOTATE_HAPPENS_AFTER(obj) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_CREATE(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_DESTROY(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_PUT(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PCQ_GET(pcq) /* empty */
|
||||||
|
#define _Py_ANNOTATE_NEW_MEMORY(address, size) /* empty */
|
||||||
|
#define _Py_ANNOTATE_EXPECT_RACE(address, description) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE(address, description) /* empty */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */
|
||||||
|
#define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */
|
||||||
|
#define _Py_ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */
|
||||||
|
#define _Py_ANNOTATE_TRACE_MEMORY(arg) /* empty */
|
||||||
|
#define _Py_ANNOTATE_THREAD_NAME(name) /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_WRITES_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */
|
||||||
|
#define _Py_ANNOTATE_IGNORE_SYNC_END() /* empty */
|
||||||
|
#define _Py_ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */
|
||||||
|
#define _Py_ANNOTATE_NO_OP(arg) /* empty */
|
||||||
|
#define _Py_ANNOTATE_FLUSH_STATE() /* empty */
|
||||||
|
|
||||||
|
#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
|
||||||
|
|
||||||
|
/* Use the macros above rather than using these functions directly. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void AnnotateRWLockCreate(const char *file, int line,
|
||||||
|
const volatile void *lock);
|
||||||
|
void AnnotateRWLockDestroy(const char *file, int line,
|
||||||
|
const volatile void *lock);
|
||||||
|
void AnnotateRWLockAcquired(const char *file, int line,
|
||||||
|
const volatile void *lock, long is_w);
|
||||||
|
void AnnotateRWLockReleased(const char *file, int line,
|
||||||
|
const volatile void *lock, long is_w);
|
||||||
|
void AnnotateBarrierInit(const char *file, int line,
|
||||||
|
const volatile void *barrier, long count,
|
||||||
|
long reinitialization_allowed);
|
||||||
|
void AnnotateBarrierWaitBefore(const char *file, int line,
|
||||||
|
const volatile void *barrier);
|
||||||
|
void AnnotateBarrierWaitAfter(const char *file, int line,
|
||||||
|
const volatile void *barrier);
|
||||||
|
void AnnotateBarrierDestroy(const char *file, int line,
|
||||||
|
const volatile void *barrier);
|
||||||
|
void AnnotateCondVarWait(const char *file, int line,
|
||||||
|
const volatile void *cv,
|
||||||
|
const volatile void *lock);
|
||||||
|
void AnnotateCondVarSignal(const char *file, int line,
|
||||||
|
const volatile void *cv);
|
||||||
|
void AnnotateCondVarSignalAll(const char *file, int line,
|
||||||
|
const volatile void *cv);
|
||||||
|
void AnnotatePublishMemoryRange(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size);
|
||||||
|
void AnnotateUnpublishMemoryRange(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size);
|
||||||
|
void AnnotatePCQCreate(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotatePCQDestroy(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotatePCQPut(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotatePCQGet(const char *file, int line,
|
||||||
|
const volatile void *pcq);
|
||||||
|
void AnnotateNewMemory(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size);
|
||||||
|
void AnnotateExpectRace(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
const char *description);
|
||||||
|
void AnnotateBenignRace(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
const char *description);
|
||||||
|
void AnnotateBenignRaceSized(const char *file, int line,
|
||||||
|
const volatile void *address,
|
||||||
|
long size,
|
||||||
|
const char *description);
|
||||||
|
void AnnotateMutexIsUsedAsCondVar(const char *file, int line,
|
||||||
|
const volatile void *mu);
|
||||||
|
void AnnotateTraceMemory(const char *file, int line,
|
||||||
|
const volatile void *arg);
|
||||||
|
void AnnotateThreadName(const char *file, int line,
|
||||||
|
const char *name);
|
||||||
|
void AnnotateIgnoreReadsBegin(const char *file, int line);
|
||||||
|
void AnnotateIgnoreReadsEnd(const char *file, int line);
|
||||||
|
void AnnotateIgnoreWritesBegin(const char *file, int line);
|
||||||
|
void AnnotateIgnoreWritesEnd(const char *file, int line);
|
||||||
|
void AnnotateEnableRaceDetection(const char *file, int line, int enable);
|
||||||
|
void AnnotateNoOp(const char *file, int line,
|
||||||
|
const volatile void *arg);
|
||||||
|
void AnnotateFlushState(const char *file, int line);
|
||||||
|
|
||||||
|
/* Return non-zero value if running under valgrind.
|
||||||
|
|
||||||
|
If "valgrind.h" is included into dynamic_annotations.c,
|
||||||
|
the regular valgrind mechanism will be used.
|
||||||
|
See http://valgrind.org/docs/manual/manual-core-adv.html about
|
||||||
|
RUNNING_ON_VALGRIND and other valgrind "client requests".
|
||||||
|
The file "valgrind.h" may be obtained by doing
|
||||||
|
svn co svn://svn.valgrind.org/valgrind/trunk/include
|
||||||
|
|
||||||
|
If for some reason you can't use "valgrind.h" or want to fake valgrind,
|
||||||
|
there are two ways to make this function return non-zero:
|
||||||
|
- Use environment variable: export RUNNING_ON_VALGRIND=1
|
||||||
|
- Make your tool intercept the function RunningOnValgrind() and
|
||||||
|
change its return value.
|
||||||
|
*/
|
||||||
|
int RunningOnValgrind(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus)
|
||||||
|
|
||||||
|
/* _Py_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads.
|
||||||
|
|
||||||
|
Instead of doing
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN();
|
||||||
|
... = x;
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END();
|
||||||
|
one can use
|
||||||
|
... = _Py_ANNOTATE_UNPROTECTED_READ(x); */
|
||||||
|
template <class T>
|
||||||
|
inline T _Py_ANNOTATE_UNPROTECTED_READ(const volatile T &x) {
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN();
|
||||||
|
T res = x;
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
/* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \
|
||||||
|
namespace { \
|
||||||
|
class static_var ## _annotator { \
|
||||||
|
public: \
|
||||||
|
static_var ## _annotator() { \
|
||||||
|
_Py_ANNOTATE_BENIGN_RACE_SIZED(&static_var, \
|
||||||
|
sizeof(static_var), \
|
||||||
|
# static_var ": " description); \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
static static_var ## _annotator the ## static_var ## _annotator;\
|
||||||
|
}
|
||||||
|
#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
|
||||||
|
|
||||||
|
#define _Py_ANNOTATE_UNPROTECTED_READ(x) (x)
|
||||||
|
#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */
|
||||||
|
|
||||||
|
#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
|
||||||
|
|
||||||
|
#endif /* __DYNAMIC_ANNOTATIONS_H__ */
|
17
include/python3.5m/enumobject.h
Normal file
17
include/python3.5m/enumobject.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef Py_ENUMOBJECT_H
|
||||||
|
#define Py_ENUMOBJECT_H
|
||||||
|
|
||||||
|
/* Enumerate Object */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyEnum_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyReversed_Type;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_ENUMOBJECT_H */
|
38
include/python3.5m/errcode.h
Normal file
38
include/python3.5m/errcode.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef Py_ERRCODE_H
|
||||||
|
#define Py_ERRCODE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Error codes passed around between file input, tokenizer, parser and
|
||||||
|
interpreter. This is necessary so we can turn them into Python
|
||||||
|
exceptions at a higher level. Note that some errors have a
|
||||||
|
slightly different meaning when passed from the tokenizer to the
|
||||||
|
parser than when passed from the parser to the interpreter; e.g.
|
||||||
|
the parser only returns E_EOF when it hits EOF immediately, and it
|
||||||
|
never returns E_OK. */
|
||||||
|
|
||||||
|
#define E_OK 10 /* No error */
|
||||||
|
#define E_EOF 11 /* End Of File */
|
||||||
|
#define E_INTR 12 /* Interrupted */
|
||||||
|
#define E_TOKEN 13 /* Bad token */
|
||||||
|
#define E_SYNTAX 14 /* Syntax error */
|
||||||
|
#define E_NOMEM 15 /* Ran out of memory */
|
||||||
|
#define E_DONE 16 /* Parsing complete */
|
||||||
|
#define E_ERROR 17 /* Execution error */
|
||||||
|
#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */
|
||||||
|
#define E_OVERFLOW 19 /* Node had too many children */
|
||||||
|
#define E_TOODEEP 20 /* Too many indentation levels */
|
||||||
|
#define E_DEDENT 21 /* No matching outer block for dedent */
|
||||||
|
#define E_DECODE 22 /* Error in decoding into Unicode */
|
||||||
|
#define E_EOFS 23 /* EOF in triple-quoted string */
|
||||||
|
#define E_EOLS 24 /* EOL in single-quoted string */
|
||||||
|
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
|
||||||
|
#define E_IDENTIFIER 26 /* Invalid characters in identifier */
|
||||||
|
#define E_BADSINGLE 27 /* Ill-formed single statement input */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_ERRCODE_H */
|
27
include/python3.5m/eval.h
Normal file
27
include/python3.5m/eval.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
/* Interface to execute compiled code */
|
||||||
|
|
||||||
|
#ifndef Py_EVAL_H
|
||||||
|
#define Py_EVAL_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
|
||||||
|
PyObject *globals,
|
||||||
|
PyObject *locals,
|
||||||
|
PyObject **args, int argc,
|
||||||
|
PyObject **kwds, int kwdc,
|
||||||
|
PyObject **defs, int defc,
|
||||||
|
PyObject *kwdefs, PyObject *closure);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_EVAL_H */
|
47
include/python3.5m/fileobject.h
Normal file
47
include/python3.5m/fileobject.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/* File object interface (what's left of it -- see io.py) */
|
||||||
|
|
||||||
|
#ifndef Py_FILEOBJECT_H
|
||||||
|
#define Py_FILEOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PY_STDIOTEXTMODE "b"
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
|
||||||
|
const char *, const char *,
|
||||||
|
const char *, int);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
||||||
|
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
||||||
|
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The default encoding used by the platform file system APIs
|
||||||
|
If non-NULL, this is different than the default encoding for strings
|
||||||
|
*/
|
||||||
|
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
||||||
|
PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
|
||||||
|
|
||||||
|
/* Internal API
|
||||||
|
|
||||||
|
The std printer acts as a preliminary sys.stderr until the new io
|
||||||
|
infrastructure is in place. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
|
||||||
|
PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* A routine to check if a file descriptor can be select()-ed. */
|
||||||
|
#ifdef HAVE_SELECT
|
||||||
|
#define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
|
||||||
|
#else
|
||||||
|
#define _PyIsSelectable_fd(FD) (1)
|
||||||
|
#endif /* HAVE_SELECT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FILEOBJECT_H */
|
142
include/python3.5m/fileutils.h
Normal file
142
include/python3.5m/fileutils.h
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
#ifndef Py_FILEUTILS_H
|
||||||
|
#define Py_FILEUTILS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
|
||||||
|
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
|
||||||
|
const char *arg,
|
||||||
|
size_t *size);
|
||||||
|
|
||||||
|
PyAPI_FUNC(char*) Py_EncodeLocale(
|
||||||
|
const wchar_t *text,
|
||||||
|
size_t *error_pos);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
struct _Py_stat_struct {
|
||||||
|
unsigned long st_dev;
|
||||||
|
__int64 st_ino;
|
||||||
|
unsigned short st_mode;
|
||||||
|
int st_nlink;
|
||||||
|
int st_uid;
|
||||||
|
int st_gid;
|
||||||
|
unsigned long st_rdev;
|
||||||
|
__int64 st_size;
|
||||||
|
time_t st_atime;
|
||||||
|
int st_atime_nsec;
|
||||||
|
time_t st_mtime;
|
||||||
|
int st_mtime_nsec;
|
||||||
|
time_t st_ctime;
|
||||||
|
int st_ctime_nsec;
|
||||||
|
unsigned long st_file_attributes;
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
# define _Py_stat_struct stat
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_fstat(
|
||||||
|
int fd,
|
||||||
|
struct _Py_stat_struct *status);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_fstat_noraise(
|
||||||
|
int fd,
|
||||||
|
struct _Py_stat_struct *status);
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_stat(
|
||||||
|
PyObject *path,
|
||||||
|
struct stat *status);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _Py_open(
|
||||||
|
const char *pathname,
|
||||||
|
int flags);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_open_noraise(
|
||||||
|
const char *pathname,
|
||||||
|
int flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(FILE *) _Py_wfopen(
|
||||||
|
const wchar_t *path,
|
||||||
|
const wchar_t *mode);
|
||||||
|
|
||||||
|
PyAPI_FUNC(FILE*) _Py_fopen(
|
||||||
|
const char *pathname,
|
||||||
|
const char *mode);
|
||||||
|
|
||||||
|
PyAPI_FUNC(FILE*) _Py_fopen_obj(
|
||||||
|
PyObject *path,
|
||||||
|
const char *mode);
|
||||||
|
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _Py_read(
|
||||||
|
int fd,
|
||||||
|
void *buf,
|
||||||
|
size_t count);
|
||||||
|
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _Py_write(
|
||||||
|
int fd,
|
||||||
|
const void *buf,
|
||||||
|
size_t count);
|
||||||
|
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
|
||||||
|
int fd,
|
||||||
|
const void *buf,
|
||||||
|
size_t count);
|
||||||
|
|
||||||
|
#ifdef HAVE_READLINK
|
||||||
|
PyAPI_FUNC(int) _Py_wreadlink(
|
||||||
|
const wchar_t *path,
|
||||||
|
wchar_t *buf,
|
||||||
|
size_t bufsiz);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_REALPATH
|
||||||
|
PyAPI_FUNC(wchar_t*) _Py_wrealpath(
|
||||||
|
const wchar_t *path,
|
||||||
|
wchar_t *resolved_path,
|
||||||
|
size_t resolved_path_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
|
||||||
|
wchar_t *buf,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
|
||||||
|
int *atomic_flag_works);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_dup(int fd);
|
||||||
|
|
||||||
|
#ifndef MS_WINDOWS
|
||||||
|
PyAPI_FUNC(int) _Py_get_blocking(int fd);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
|
||||||
|
#endif /* !MS_WINDOWS */
|
||||||
|
|
||||||
|
#if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900
|
||||||
|
/* A routine to check if a file descriptor is valid on Windows. Returns 0
|
||||||
|
* and sets errno to EBADF if it isn't. This is to avoid Assertions
|
||||||
|
* from various functions in the Windows CRT beginning with
|
||||||
|
* Visual Studio 2005
|
||||||
|
*/
|
||||||
|
int _PyVerify_fd(int fd);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define _PyVerify_fd(A) (1) /* dummy */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_FILEUTILS_H */
|
128
include/python3.5m/floatobject.h
Normal file
128
include/python3.5m/floatobject.h
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
|
||||||
|
/* Float object interface */
|
||||||
|
|
||||||
|
/*
|
||||||
|
PyFloatObject represents a (double precision) floating point number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_FLOATOBJECT_H
|
||||||
|
#define Py_FLOATOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
double ob_fval;
|
||||||
|
} PyFloatObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
||||||
|
|
||||||
|
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
||||||
|
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
|
||||||
|
|
||||||
|
#ifdef Py_NAN
|
||||||
|
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Py_RETURN_INF(sign) do \
|
||||||
|
if (copysign(1., sign) == 1.) { \
|
||||||
|
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
||||||
|
} else { \
|
||||||
|
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
||||||
|
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
|
||||||
|
|
||||||
|
/* Return Python float from string PyObject. */
|
||||||
|
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);
|
||||||
|
|
||||||
|
/* Return Python float from C double. */
|
||||||
|
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
|
||||||
|
|
||||||
|
/* Extract C double from Python float. The macro version trades safety for
|
||||||
|
speed. */
|
||||||
|
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* _PyFloat_{Pack,Unpack}{4,8}
|
||||||
|
*
|
||||||
|
* The struct and pickle (at least) modules need an efficient platform-
|
||||||
|
* independent way to store floating-point values as byte strings.
|
||||||
|
* The Pack routines produce a string from a C double, and the Unpack
|
||||||
|
* routines produce a C double from such a string. The suffix (4 or 8)
|
||||||
|
* specifies the number of bytes in the string.
|
||||||
|
*
|
||||||
|
* On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats
|
||||||
|
* these functions work by copying bits. On other platforms, the formats the
|
||||||
|
* 4- byte format is identical to the IEEE-754 single precision format, and
|
||||||
|
* the 8-byte format to the IEEE-754 double precision format, although the
|
||||||
|
* packing of INFs and NaNs (if such things exist on the platform) isn't
|
||||||
|
* handled correctly, and attempting to unpack a string containing an IEEE
|
||||||
|
* INF or NaN will raise an exception.
|
||||||
|
*
|
||||||
|
* On non-IEEE platforms with more precision, or larger dynamic range, than
|
||||||
|
* 754 supports, not all values can be packed; on non-IEEE platforms with less
|
||||||
|
* precision, or smaller dynamic range, not all values can be unpacked. What
|
||||||
|
* happens in such cases is partly accidental (alas).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The pack routines write 4 or 8 bytes, starting at p. le is a bool
|
||||||
|
* argument, true if you want the string in little-endian format (exponent
|
||||||
|
* last, at p+3 or p+7), false if you want big-endian format (exponent
|
||||||
|
* first, at p).
|
||||||
|
* Return value: 0 if all is OK, -1 if error (and an exception is
|
||||||
|
* set, most likely OverflowError).
|
||||||
|
* There are two problems on non-IEEE platforms:
|
||||||
|
* 1): What this does is undefined if x is a NaN or infinity.
|
||||||
|
* 2): -0.0 and +0.0 produce the same string.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
|
||||||
|
|
||||||
|
/* Needed for the old way for marshal to store a floating point number.
|
||||||
|
Returns the string length copied into p, -1 on error.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Repr(double x, char *p, size_t len);
|
||||||
|
|
||||||
|
/* Used to get the important decimal digits of a double */
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
|
||||||
|
PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
|
||||||
|
|
||||||
|
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
|
||||||
|
* argument, true if the string is in little-endian format (exponent
|
||||||
|
* last, at p+3 or p+7), false if big-endian (exponent first, at p).
|
||||||
|
* Return value: The unpacked double. On error, this is -1.0 and
|
||||||
|
* PyErr_Occurred() is true (and an exception is set, most likely
|
||||||
|
* OverflowError). Note that on a non-IEEE platform this will refuse
|
||||||
|
* to unpack a string that represents a NaN or infinity.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
|
||||||
|
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
|
||||||
|
|
||||||
|
/* free list api */
|
||||||
|
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
|
||||||
|
|
||||||
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||||
|
(Advanced String Formatting). */
|
||||||
|
PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
|
||||||
|
_PyUnicodeWriter *writer,
|
||||||
|
PyObject *obj,
|
||||||
|
PyObject *format_spec,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end);
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FLOATOBJECT_H */
|
95
include/python3.5m/frameobject.h
Normal file
95
include/python3.5m/frameobject.h
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
|
||||||
|
/* Frame object interface */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_FRAMEOBJECT_H
|
||||||
|
#define Py_FRAMEOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int b_type; /* what kind of block this is */
|
||||||
|
int b_handler; /* where to jump to find handler */
|
||||||
|
int b_level; /* value stack level to pop to */
|
||||||
|
} PyTryBlock;
|
||||||
|
|
||||||
|
typedef struct _frame {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
struct _frame *f_back; /* previous frame, or NULL */
|
||||||
|
PyCodeObject *f_code; /* code segment */
|
||||||
|
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
|
||||||
|
PyObject *f_globals; /* global symbol table (PyDictObject) */
|
||||||
|
PyObject *f_locals; /* local symbol table (any mapping) */
|
||||||
|
PyObject **f_valuestack; /* points after the last local */
|
||||||
|
/* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
|
||||||
|
Frame evaluation usually NULLs it, but a frame that yields sets it
|
||||||
|
to the current stack top. */
|
||||||
|
PyObject **f_stacktop;
|
||||||
|
PyObject *f_trace; /* Trace function */
|
||||||
|
|
||||||
|
/* In a generator, we need to be able to swap between the exception
|
||||||
|
state inside the generator and the exception state of the calling
|
||||||
|
frame (which shouldn't be impacted when the generator "yields"
|
||||||
|
from an except handler).
|
||||||
|
These three fields exist exactly for that, and are unused for
|
||||||
|
non-generator frames. See the save_exc_state and swap_exc_state
|
||||||
|
functions in ceval.c for details of their use. */
|
||||||
|
PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
|
||||||
|
/* Borrowed reference to a generator, or NULL */
|
||||||
|
PyObject *f_gen;
|
||||||
|
|
||||||
|
int f_lasti; /* Last instruction if called */
|
||||||
|
/* Call PyFrame_GetLineNumber() instead of reading this field
|
||||||
|
directly. As of 2.3 f_lineno is only valid when tracing is
|
||||||
|
active (i.e. when f_trace is set). At other times we use
|
||||||
|
PyCode_Addr2Line to calculate the line from the current
|
||||||
|
bytecode index. */
|
||||||
|
int f_lineno; /* Current line number */
|
||||||
|
int f_iblock; /* index in f_blockstack */
|
||||||
|
char f_executing; /* whether the frame is still executing */
|
||||||
|
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
|
||||||
|
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
|
||||||
|
} PyFrameObject;
|
||||||
|
|
||||||
|
|
||||||
|
/* Standard object interface */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFrame_Type;
|
||||||
|
|
||||||
|
#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
|
||||||
|
PyObject *, PyObject *);
|
||||||
|
|
||||||
|
|
||||||
|
/* The rest of the interface is specific for frame objects */
|
||||||
|
|
||||||
|
/* Block management functions */
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
|
||||||
|
PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
|
||||||
|
|
||||||
|
/* Extend the value stack */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);
|
||||||
|
|
||||||
|
/* Conversions between "fast locals" and locals in dictionary */
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
|
||||||
|
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
|
||||||
|
|
||||||
|
/* Return the line of code the frame is currently executing. */
|
||||||
|
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FRAMEOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
89
include/python3.5m/funcobject.h
Normal file
89
include/python3.5m/funcobject.h
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
|
||||||
|
/* Function object interface */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_FUNCOBJECT_H
|
||||||
|
#define Py_FUNCOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Function objects and code objects should not be confused with each other:
|
||||||
|
*
|
||||||
|
* Function objects are created by the execution of the 'def' statement.
|
||||||
|
* They reference a code object in their __code__ attribute, which is a
|
||||||
|
* purely syntactic object, i.e. nothing more than a compiled version of some
|
||||||
|
* source code lines. There is one code object per source code "fragment",
|
||||||
|
* but each code object can be referenced by zero or many function objects
|
||||||
|
* depending only on how many times the 'def' statement in the source was
|
||||||
|
* executed so far.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject *func_code; /* A code object, the __code__ attribute */
|
||||||
|
PyObject *func_globals; /* A dictionary (other mappings won't do) */
|
||||||
|
PyObject *func_defaults; /* NULL or a tuple */
|
||||||
|
PyObject *func_kwdefaults; /* NULL or a dict */
|
||||||
|
PyObject *func_closure; /* NULL or a tuple of cell objects */
|
||||||
|
PyObject *func_doc; /* The __doc__ attribute, can be anything */
|
||||||
|
PyObject *func_name; /* The __name__ attribute, a string object */
|
||||||
|
PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */
|
||||||
|
PyObject *func_weakreflist; /* List of weak references */
|
||||||
|
PyObject *func_module; /* The __module__ attribute, can be anything */
|
||||||
|
PyObject *func_annotations; /* Annotations, a dict or NULL */
|
||||||
|
PyObject *func_qualname; /* The qualified name */
|
||||||
|
|
||||||
|
/* Invariant:
|
||||||
|
* func_closure contains the bindings for func_code->co_freevars, so
|
||||||
|
* PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code)
|
||||||
|
* (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0).
|
||||||
|
*/
|
||||||
|
} PyFunctionObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyFunction_Type;
|
||||||
|
|
||||||
|
#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
|
done, so use with care. */
|
||||||
|
#define PyFunction_GET_CODE(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_code)
|
||||||
|
#define PyFunction_GET_GLOBALS(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_globals)
|
||||||
|
#define PyFunction_GET_MODULE(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_module)
|
||||||
|
#define PyFunction_GET_DEFAULTS(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_defaults)
|
||||||
|
#define PyFunction_GET_KW_DEFAULTS(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_kwdefaults)
|
||||||
|
#define PyFunction_GET_CLOSURE(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_closure)
|
||||||
|
#define PyFunction_GET_ANNOTATIONS(func) \
|
||||||
|
(((PyFunctionObject *)func) -> func_annotations)
|
||||||
|
|
||||||
|
/* The classmethod and staticmethod types lives here, too */
|
||||||
|
PyAPI_DATA(PyTypeObject) PyClassMethod_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyStaticMethod_Type;
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_FUNCOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
68
include/python3.5m/genobject.h
Normal file
68
include/python3.5m/genobject.h
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
/* Generator object interface */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_GENOBJECT_H
|
||||||
|
#define Py_GENOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct _frame; /* Avoid including frameobject.h */
|
||||||
|
|
||||||
|
/* _PyGenObject_HEAD defines the initial segment of generator
|
||||||
|
and coroutine objects. */
|
||||||
|
#define _PyGenObject_HEAD(prefix) \
|
||||||
|
PyObject_HEAD \
|
||||||
|
/* Note: gi_frame can be NULL if the generator is "finished" */ \
|
||||||
|
struct _frame *prefix##_frame; \
|
||||||
|
/* True if generator is being executed. */ \
|
||||||
|
char prefix##_running; \
|
||||||
|
/* The code object backing the generator */ \
|
||||||
|
PyObject *prefix##_code; \
|
||||||
|
/* List of weak reference. */ \
|
||||||
|
PyObject *prefix##_weakreflist; \
|
||||||
|
/* Name of the generator. */ \
|
||||||
|
PyObject *prefix##_name; \
|
||||||
|
/* Qualified name of the generator. */ \
|
||||||
|
PyObject *prefix##_qualname;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* The gi_ prefix is intended to remind of generator-iterator. */
|
||||||
|
_PyGenObject_HEAD(gi)
|
||||||
|
} PyGenObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyGen_Type;
|
||||||
|
|
||||||
|
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
|
||||||
|
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *,
|
||||||
|
PyObject *name, PyObject *qualname);
|
||||||
|
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
|
||||||
|
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
|
||||||
|
PyObject *_PyGen_Send(PyGenObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
_PyGenObject_HEAD(cr)
|
||||||
|
} PyCoroObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCoro_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
|
||||||
|
|
||||||
|
#define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type)
|
||||||
|
PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
|
||||||
|
PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *,
|
||||||
|
PyObject *name, PyObject *qualname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef _PyGenObject_HEAD
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_GENOBJECT_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
87
include/python3.5m/graminit.h
Normal file
87
include/python3.5m/graminit.h
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/* Generated by Parser/pgen */
|
||||||
|
|
||||||
|
#define single_input 256
|
||||||
|
#define file_input 257
|
||||||
|
#define eval_input 258
|
||||||
|
#define decorator 259
|
||||||
|
#define decorators 260
|
||||||
|
#define decorated 261
|
||||||
|
#define async_funcdef 262
|
||||||
|
#define funcdef 263
|
||||||
|
#define parameters 264
|
||||||
|
#define typedargslist 265
|
||||||
|
#define tfpdef 266
|
||||||
|
#define varargslist 267
|
||||||
|
#define vfpdef 268
|
||||||
|
#define stmt 269
|
||||||
|
#define simple_stmt 270
|
||||||
|
#define small_stmt 271
|
||||||
|
#define expr_stmt 272
|
||||||
|
#define testlist_star_expr 273
|
||||||
|
#define augassign 274
|
||||||
|
#define del_stmt 275
|
||||||
|
#define pass_stmt 276
|
||||||
|
#define flow_stmt 277
|
||||||
|
#define break_stmt 278
|
||||||
|
#define continue_stmt 279
|
||||||
|
#define return_stmt 280
|
||||||
|
#define yield_stmt 281
|
||||||
|
#define raise_stmt 282
|
||||||
|
#define import_stmt 283
|
||||||
|
#define import_name 284
|
||||||
|
#define import_from 285
|
||||||
|
#define import_as_name 286
|
||||||
|
#define dotted_as_name 287
|
||||||
|
#define import_as_names 288
|
||||||
|
#define dotted_as_names 289
|
||||||
|
#define dotted_name 290
|
||||||
|
#define global_stmt 291
|
||||||
|
#define nonlocal_stmt 292
|
||||||
|
#define assert_stmt 293
|
||||||
|
#define compound_stmt 294
|
||||||
|
#define async_stmt 295
|
||||||
|
#define if_stmt 296
|
||||||
|
#define while_stmt 297
|
||||||
|
#define for_stmt 298
|
||||||
|
#define try_stmt 299
|
||||||
|
#define with_stmt 300
|
||||||
|
#define with_item 301
|
||||||
|
#define except_clause 302
|
||||||
|
#define suite 303
|
||||||
|
#define test 304
|
||||||
|
#define test_nocond 305
|
||||||
|
#define lambdef 306
|
||||||
|
#define lambdef_nocond 307
|
||||||
|
#define or_test 308
|
||||||
|
#define and_test 309
|
||||||
|
#define not_test 310
|
||||||
|
#define comparison 311
|
||||||
|
#define comp_op 312
|
||||||
|
#define star_expr 313
|
||||||
|
#define expr 314
|
||||||
|
#define xor_expr 315
|
||||||
|
#define and_expr 316
|
||||||
|
#define shift_expr 317
|
||||||
|
#define arith_expr 318
|
||||||
|
#define term 319
|
||||||
|
#define factor 320
|
||||||
|
#define power 321
|
||||||
|
#define atom_expr 322
|
||||||
|
#define atom 323
|
||||||
|
#define testlist_comp 324
|
||||||
|
#define trailer 325
|
||||||
|
#define subscriptlist 326
|
||||||
|
#define subscript 327
|
||||||
|
#define sliceop 328
|
||||||
|
#define exprlist 329
|
||||||
|
#define testlist 330
|
||||||
|
#define dictorsetmaker 331
|
||||||
|
#define classdef 332
|
||||||
|
#define arglist 333
|
||||||
|
#define argument 334
|
||||||
|
#define comp_iter 335
|
||||||
|
#define comp_for 336
|
||||||
|
#define comp_if 337
|
||||||
|
#define encoding_decl 338
|
||||||
|
#define yield_expr 339
|
||||||
|
#define yield_arg 340
|
93
include/python3.5m/grammar.h
Normal file
93
include/python3.5m/grammar.h
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
|
||||||
|
/* Grammar interface */
|
||||||
|
|
||||||
|
#ifndef Py_GRAMMAR_H
|
||||||
|
#define Py_GRAMMAR_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "bitset.h" /* Sigh... */
|
||||||
|
|
||||||
|
/* A label of an arc */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int lb_type;
|
||||||
|
char *lb_str;
|
||||||
|
} label;
|
||||||
|
|
||||||
|
#define EMPTY 0 /* Label number 0 is by definition the empty label */
|
||||||
|
|
||||||
|
/* A list of labels */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ll_nlabels;
|
||||||
|
label *ll_label;
|
||||||
|
} labellist;
|
||||||
|
|
||||||
|
/* An arc from one state to another */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
short a_lbl; /* Label of this arc */
|
||||||
|
short a_arrow; /* State where this arc goes to */
|
||||||
|
} arc;
|
||||||
|
|
||||||
|
/* A state in a DFA */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int s_narcs;
|
||||||
|
arc *s_arc; /* Array of arcs */
|
||||||
|
|
||||||
|
/* Optional accelerators */
|
||||||
|
int s_lower; /* Lowest label index */
|
||||||
|
int s_upper; /* Highest label index */
|
||||||
|
int *s_accel; /* Accelerator */
|
||||||
|
int s_accept; /* Nonzero for accepting state */
|
||||||
|
} state;
|
||||||
|
|
||||||
|
/* A DFA */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int d_type; /* Non-terminal this represents */
|
||||||
|
char *d_name; /* For printing */
|
||||||
|
int d_initial; /* Initial state */
|
||||||
|
int d_nstates;
|
||||||
|
state *d_state; /* Array of states */
|
||||||
|
bitset d_first;
|
||||||
|
} dfa;
|
||||||
|
|
||||||
|
/* A grammar */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int g_ndfas;
|
||||||
|
dfa *g_dfa; /* Array of DFAs */
|
||||||
|
labellist g_ll;
|
||||||
|
int g_start; /* Start symbol of the grammar */
|
||||||
|
int g_accel; /* Set if accelerators present */
|
||||||
|
} grammar;
|
||||||
|
|
||||||
|
/* FUNCTIONS */
|
||||||
|
|
||||||
|
grammar *newgrammar(int start);
|
||||||
|
dfa *adddfa(grammar *g, int type, const char *name);
|
||||||
|
int addstate(dfa *d);
|
||||||
|
void addarc(dfa *d, int from, int to, int lbl);
|
||||||
|
dfa *PyGrammar_FindDFA(grammar *g, int type);
|
||||||
|
|
||||||
|
int addlabel(labellist *ll, int type, const char *str);
|
||||||
|
int findlabel(labellist *ll, int type, const char *str);
|
||||||
|
const char *PyGrammar_LabelRepr(label *lb);
|
||||||
|
void translatelabels(grammar *g);
|
||||||
|
|
||||||
|
void addfirstsets(grammar *g);
|
||||||
|
|
||||||
|
void PyGrammar_AddAccelerators(grammar *g);
|
||||||
|
void PyGrammar_RemoveAccelerators(grammar *);
|
||||||
|
|
||||||
|
void printgrammar(grammar *g, FILE *fp);
|
||||||
|
void printnonterminals(grammar *g, FILE *fp);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_GRAMMAR_H */
|
130
include/python3.5m/import.h
Normal file
130
include/python3.5m/import.h
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
|
||||||
|
/* Module definition and import interface */
|
||||||
|
|
||||||
|
#ifndef Py_IMPORT_H
|
||||||
|
#define Py_IMPORT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyImportZip_Init(void);
|
||||||
|
|
||||||
|
PyMODINIT_FUNC PyInit_imp(void);
|
||||||
|
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
||||||
|
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *co
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *co,
|
||||||
|
const char *pathname /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *co,
|
||||||
|
const char *pathname, /* decoded from the filesystem encoding */
|
||||||
|
const char *cpathname /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
|
||||||
|
PyObject *name,
|
||||||
|
PyObject *co,
|
||||||
|
PyObject *pathname,
|
||||||
|
PyObject *cpathname
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
|
||||||
|
PyObject *name
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_AddModule(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
PyObject *globals,
|
||||||
|
PyObject *locals,
|
||||||
|
PyObject *fromlist,
|
||||||
|
int level
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
|
||||||
|
PyObject *name,
|
||||||
|
PyObject *globals,
|
||||||
|
PyObject *locals,
|
||||||
|
PyObject *fromlist,
|
||||||
|
int level
|
||||||
|
);
|
||||||
|
|
||||||
|
#define PyImport_ImportModuleEx(n, g, l, f) \
|
||||||
|
PyImport_ImportModuleLevel(n, g, l, f, 0)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
||||||
|
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
|
||||||
|
PyAPI_FUNC(void) PyImport_Cleanup(void);
|
||||||
|
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
|
||||||
|
PyObject *name
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifdef WITH_THREAD
|
||||||
|
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
|
||||||
|
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
|
||||||
|
#else
|
||||||
|
#define _PyImport_AcquireLock()
|
||||||
|
#define _PyImport_ReleaseLock() 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
|
||||||
|
PyObject *mod,
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
struct _inittab {
|
||||||
|
const char *name; /* ASCII encoded string */
|
||||||
|
PyObject* (*initfunc)(void);
|
||||||
|
};
|
||||||
|
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
|
||||||
|
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyImport_AppendInittab(
|
||||||
|
const char *name, /* ASCII encoded string */
|
||||||
|
PyObject* (*initfunc)(void)
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
struct _frozen {
|
||||||
|
const char *name; /* ASCII encoded string */
|
||||||
|
const unsigned char *code;
|
||||||
|
int size;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Embedding apps may change this pointer to point to their favorite
|
||||||
|
collection of frozen modules: */
|
||||||
|
|
||||||
|
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_IMPORT_H */
|
21
include/python3.5m/intrcheck.h
Normal file
21
include/python3.5m/intrcheck.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
#ifndef Py_INTRCHECK_H
|
||||||
|
#define Py_INTRCHECK_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
|
||||||
|
PyAPI_FUNC(void) PyOS_InitInterrupts(void);
|
||||||
|
PyAPI_FUNC(void) PyOS_AfterFork(void);
|
||||||
|
PyAPI_FUNC(int) _PyOS_IsMainThread(void);
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
/* windows.h is not included by Python.h so use void* instead of HANDLE */
|
||||||
|
PyAPI_FUNC(void*) _PyOS_SigintEvent(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_INTRCHECK_H */
|
25
include/python3.5m/iterobject.h
Normal file
25
include/python3.5m/iterobject.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef Py_ITEROBJECT_H
|
||||||
|
#define Py_ITEROBJECT_H
|
||||||
|
/* Iterators (the basic kind, over a sequence) */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PySeqIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCallIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type;
|
||||||
|
|
||||||
|
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
|
||||||
|
|
||||||
|
|
||||||
|
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_ITEROBJECT_H */
|
||||||
|
|
81
include/python3.5m/listobject.h
Normal file
81
include/python3.5m/listobject.h
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
|
||||||
|
/* List object interface */
|
||||||
|
|
||||||
|
/*
|
||||||
|
Another generally useful object type is an list of object pointers.
|
||||||
|
This is a mutable type: the list items can be changed, and items can be
|
||||||
|
added or removed. Out-of-range indices or non-list objects are ignored.
|
||||||
|
|
||||||
|
*** WARNING *** PyList_SetItem does not increment the new item's reference
|
||||||
|
count, but does decrement the reference count of the item it replaces,
|
||||||
|
if not nil. It does *decrement* the reference count if it is *not*
|
||||||
|
inserted in the list. Similarly, PyList_GetItem does not increment the
|
||||||
|
returned item's reference count.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LISTOBJECT_H
|
||||||
|
#define Py_LISTOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
|
||||||
|
PyObject **ob_item;
|
||||||
|
|
||||||
|
/* ob_item contains space for 'allocated' elements. The number
|
||||||
|
* currently in use is ob_size.
|
||||||
|
* Invariants:
|
||||||
|
* 0 <= ob_size <= allocated
|
||||||
|
* len(list) == ob_size
|
||||||
|
* ob_item == NULL implies ob_size == allocated == 0
|
||||||
|
* list.sort() temporarily sets allocated to -1 to detect mutations.
|
||||||
|
*
|
||||||
|
* Items must normally not be NULL, except during construction when
|
||||||
|
* the list is not yet visible outside the function that builds it.
|
||||||
|
*/
|
||||||
|
Py_ssize_t allocated;
|
||||||
|
} PyListObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyList_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyListIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PySortWrapper_Type;
|
||||||
|
|
||||||
|
#define PyList_Check(op) \
|
||||||
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
|
||||||
|
#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyList_Sort(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyList_ClearFreeList(void);
|
||||||
|
PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Macro, trading safety for speed */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
|
||||||
|
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
|
||||||
|
#define PyList_GET_SIZE(op) Py_SIZE(op)
|
||||||
|
#define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_LISTOBJECT_H */
|
103
include/python3.5m/longintrepr.h
Normal file
103
include/python3.5m/longintrepr.h
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_LONGINTREPR_H
|
||||||
|
#define Py_LONGINTREPR_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* This is published for the benefit of "friends" marshal.c and _decimal.c. */
|
||||||
|
|
||||||
|
/* Parameters of the integer representation. There are two different
|
||||||
|
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
|
||||||
|
integer type, and one set for 15-bit digits with each digit stored in an
|
||||||
|
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
|
||||||
|
configure time or in pyport.h, is used to decide which digit size to use.
|
||||||
|
|
||||||
|
Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'
|
||||||
|
should be an unsigned integer type able to hold all integers up to
|
||||||
|
PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type,
|
||||||
|
and that overflow is handled by taking the result modulo 2**N for some N >
|
||||||
|
PyLong_SHIFT. The majority of the code doesn't care about the precise
|
||||||
|
value of PyLong_SHIFT, but there are some notable exceptions:
|
||||||
|
|
||||||
|
- long_pow() requires that PyLong_SHIFT be divisible by 5
|
||||||
|
|
||||||
|
- PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8
|
||||||
|
|
||||||
|
- long_hash() requires that PyLong_SHIFT is *strictly* less than the number
|
||||||
|
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
|
||||||
|
conversion functions
|
||||||
|
|
||||||
|
- the Python int <-> size_t/Py_ssize_t conversion functions expect that
|
||||||
|
PyLong_SHIFT is strictly less than the number of bits in a size_t
|
||||||
|
|
||||||
|
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
|
||||||
|
|
||||||
|
- NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single
|
||||||
|
digit; with the current values this forces PyLong_SHIFT >= 9
|
||||||
|
|
||||||
|
The values 15 and 30 should fit all of the above requirements, on any
|
||||||
|
platform.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if PYLONG_BITS_IN_DIGIT == 30
|
||||||
|
#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \
|
||||||
|
defined HAVE_INT64_T && defined HAVE_INT32_T)
|
||||||
|
#error "30-bit long digits requested, but the necessary types are not available on this platform"
|
||||||
|
#endif
|
||||||
|
typedef PY_UINT32_T digit;
|
||||||
|
typedef PY_INT32_T sdigit; /* signed variant of digit */
|
||||||
|
typedef PY_UINT64_T twodigits;
|
||||||
|
typedef PY_INT64_T stwodigits; /* signed variant of twodigits */
|
||||||
|
#define PyLong_SHIFT 30
|
||||||
|
#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */
|
||||||
|
#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */
|
||||||
|
#elif PYLONG_BITS_IN_DIGIT == 15
|
||||||
|
typedef unsigned short digit;
|
||||||
|
typedef short sdigit; /* signed variant of digit */
|
||||||
|
typedef unsigned long twodigits;
|
||||||
|
typedef long stwodigits; /* signed variant of twodigits */
|
||||||
|
#define PyLong_SHIFT 15
|
||||||
|
#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */
|
||||||
|
#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */
|
||||||
|
#else
|
||||||
|
#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"
|
||||||
|
#endif
|
||||||
|
#define PyLong_BASE ((digit)1 << PyLong_SHIFT)
|
||||||
|
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
|
||||||
|
|
||||||
|
#if PyLong_SHIFT % 5 != 0
|
||||||
|
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Long integer representation.
|
||||||
|
The absolute value of a number is equal to
|
||||||
|
SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)
|
||||||
|
Negative numbers are represented with ob_size < 0;
|
||||||
|
zero is represented by ob_size == 0.
|
||||||
|
In a normalized number, ob_digit[abs(ob_size)-1] (the most significant
|
||||||
|
digit) is never zero. Also, in all cases, for all valid i,
|
||||||
|
0 <= ob_digit[i] <= MASK.
|
||||||
|
The allocation function takes care of allocating extra memory
|
||||||
|
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
|
||||||
|
|
||||||
|
CAUTION: Generic code manipulating subtypes of PyVarObject has to
|
||||||
|
aware that ints abuse ob_size's sign bit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct _longobject {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
digit ob_digit[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
|
||||||
|
|
||||||
|
/* Return a copy of src. */
|
||||||
|
PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_LONGINTREPR_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
207
include/python3.5m/longobject.h
Normal file
207
include/python3.5m/longobject.h
Normal file
|
@ -0,0 +1,207 @@
|
||||||
|
#ifndef Py_LONGOBJECT_H
|
||||||
|
#define Py_LONGOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Long (arbitrary precision) integer object interface */
|
||||||
|
|
||||||
|
typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyLong_Type;
|
||||||
|
|
||||||
|
#define PyLong_Check(op) \
|
||||||
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
|
||||||
|
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromDouble(double);
|
||||||
|
PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
|
||||||
|
PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
|
||||||
|
PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
|
||||||
|
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
|
||||||
|
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
|
||||||
|
|
||||||
|
/* It may be useful in the future. I've added it in the PyInt -> PyLong
|
||||||
|
cleanup to keep the extra information. [CH] */
|
||||||
|
#define PyLong_AS_LONG(op) PyLong_AsLong(op)
|
||||||
|
|
||||||
|
/* Issue #1983: pid_t can be longer than a C long on some systems */
|
||||||
|
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
|
||||||
|
#define _Py_PARSE_PID "i"
|
||||||
|
#define PyLong_FromPid PyLong_FromLong
|
||||||
|
#define PyLong_AsPid PyLong_AsLong
|
||||||
|
#elif SIZEOF_PID_T == SIZEOF_LONG
|
||||||
|
#define _Py_PARSE_PID "l"
|
||||||
|
#define PyLong_FromPid PyLong_FromLong
|
||||||
|
#define PyLong_AsPid PyLong_AsLong
|
||||||
|
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG
|
||||||
|
#define _Py_PARSE_PID "L"
|
||||||
|
#define PyLong_FromPid PyLong_FromLongLong
|
||||||
|
#define PyLong_AsPid PyLong_AsLongLong
|
||||||
|
#else
|
||||||
|
#error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)"
|
||||||
|
#endif /* SIZEOF_PID_T */
|
||||||
|
|
||||||
|
#if SIZEOF_VOID_P == SIZEOF_INT
|
||||||
|
# define _Py_PARSE_INTPTR "i"
|
||||||
|
# define _Py_PARSE_UINTPTR "I"
|
||||||
|
#elif SIZEOF_VOID_P == SIZEOF_LONG
|
||||||
|
# define _Py_PARSE_INTPTR "l"
|
||||||
|
# define _Py_PARSE_UINTPTR "k"
|
||||||
|
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_VOID_P == SIZEOF_LONG_LONG
|
||||||
|
# define _Py_PARSE_INTPTR "L"
|
||||||
|
# define _Py_PARSE_UINTPTR "K"
|
||||||
|
#else
|
||||||
|
# error "void* different in size from int, long and long long"
|
||||||
|
#endif /* SIZEOF_VOID_P */
|
||||||
|
|
||||||
|
/* Used by Python/mystrtoul.c. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _PyLong_Frexp returns a double x and an exponent e such that the
|
||||||
|
true value is approximately equal to x * 2**e. e is >= 0. x is
|
||||||
|
0.0 if and only if the input is 0 (in which case, e and x are both
|
||||||
|
zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
|
||||||
|
possible if the number of bits doesn't fit into a Py_ssize_t, sets
|
||||||
|
OverflowError and returns -1.0 for x, 0 for e. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
|
||||||
|
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
|
||||||
|
|
||||||
|
#ifdef HAVE_LONG_LONG
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
|
||||||
|
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
|
||||||
|
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
|
||||||
|
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
|
||||||
|
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
||||||
|
#endif /* HAVE_LONG_LONG */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
|
||||||
|
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
|
||||||
|
v must not be NULL, and must be a normalized long.
|
||||||
|
There are no error cases.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
|
||||||
|
|
||||||
|
|
||||||
|
/* _PyLong_NumBits. Return the number of bits needed to represent the
|
||||||
|
absolute value of a long. For example, this returns 1 for 1 and -1, 2
|
||||||
|
for 2 and -2, and 2 for 3 and -3. It returns 0 for 0.
|
||||||
|
v must not be NULL, and must be a normalized long.
|
||||||
|
(size_t)-1 is returned and OverflowError set if the true result doesn't
|
||||||
|
fit in a size_t.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
|
||||||
|
|
||||||
|
/* _PyLong_DivmodNear. Given integers a and b, compute the nearest
|
||||||
|
integer q to the exact quotient a / b, rounding to the nearest even integer
|
||||||
|
in the case of a tie. Return (q, r), where r = a - q*b. The remainder r
|
||||||
|
will satisfy abs(r) <= abs(b)/2, with equality possible only if q is
|
||||||
|
even.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyLong_DivmodNear(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
|
||||||
|
base 256, and return a Python int with the same numeric value.
|
||||||
|
If n is 0, the integer is 0. Else:
|
||||||
|
If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB;
|
||||||
|
else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the
|
||||||
|
LSB.
|
||||||
|
If is_signed is 0/false, view the bytes as a non-negative integer.
|
||||||
|
If is_signed is 1/true, view the bytes as a 2's-complement integer,
|
||||||
|
non-negative if bit 0x80 of the MSB is clear, negative if set.
|
||||||
|
Error returns:
|
||||||
|
+ Return NULL with the appropriate exception set if there's not
|
||||||
|
enough memory to create the Python int.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
|
||||||
|
const unsigned char* bytes, size_t n,
|
||||||
|
int little_endian, int is_signed);
|
||||||
|
|
||||||
|
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
|
||||||
|
v to a base-256 integer, stored in array bytes. Normally return 0,
|
||||||
|
return -1 on error.
|
||||||
|
If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at
|
||||||
|
bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and
|
||||||
|
the LSB at bytes[n-1].
|
||||||
|
If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes
|
||||||
|
are filled and there's nothing special about bit 0x80 of the MSB.
|
||||||
|
If is_signed is 1/true, bytes is filled with the 2's-complement
|
||||||
|
representation of v's value. Bit 0x80 of the MSB is the sign bit.
|
||||||
|
Error returns (-1):
|
||||||
|
+ is_signed is 0 and v < 0. TypeError is set in this case, and bytes
|
||||||
|
isn't altered.
|
||||||
|
+ n isn't big enough to hold the full mathematical value of v. For
|
||||||
|
example, if is_signed is 0 and there are more digits in the v than
|
||||||
|
fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
|
||||||
|
being large enough to hold a sign bit. OverflowError is set in this
|
||||||
|
case, but bytes holds the least-signficant n bytes of the true value.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
|
||||||
|
unsigned char* bytes, size_t n,
|
||||||
|
int little_endian, int is_signed);
|
||||||
|
|
||||||
|
/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
|
||||||
|
using the nb_int slot, if available. Raise TypeError if either the
|
||||||
|
nb_int slot is not available or the result of the call to nb_int
|
||||||
|
returns something not of type int.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyLongObject *)_PyLong_FromNbInt(PyObject *);
|
||||||
|
|
||||||
|
/* _PyLong_Format: Convert the long to a string object with given base,
|
||||||
|
appending a base prefix of 0[box] if base is 2, 8 or 16. */
|
||||||
|
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _PyLong_FormatWriter(
|
||||||
|
_PyUnicodeWriter *writer,
|
||||||
|
PyObject *obj,
|
||||||
|
int base,
|
||||||
|
int alternate);
|
||||||
|
|
||||||
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||||
|
(Advanced String Formatting). */
|
||||||
|
PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter(
|
||||||
|
_PyUnicodeWriter *writer,
|
||||||
|
PyObject *obj,
|
||||||
|
PyObject *format_spec,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end);
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* These aren't really part of the int object, but they're handy. The
|
||||||
|
functions are in Python/mystrtoul.c.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(unsigned long) PyOS_strtoul(const char *, char **, int);
|
||||||
|
PyAPI_FUNC(long) PyOS_strtol(const char *, char **, int);
|
||||||
|
|
||||||
|
/* For use by the gcd function in mathmodule.c */
|
||||||
|
PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_LONGOBJECT_H */
|
28
include/python3.5m/marshal.h
Normal file
28
include/python3.5m/marshal.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
/* Interface for marshal.c */
|
||||||
|
|
||||||
|
#ifndef Py_MARSHAL_H
|
||||||
|
#define Py_MARSHAL_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Py_MARSHAL_VERSION 4
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
|
||||||
|
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);
|
||||||
|
PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *);
|
||||||
|
PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *,
|
||||||
|
Py_ssize_t);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_MARSHAL_H */
|
70
include/python3.5m/memoryobject.h
Normal file
70
include/python3.5m/memoryobject.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
/* Memory view object. In Python this is available as "memoryview". */
|
||||||
|
|
||||||
|
#ifndef Py_MEMORYOBJECT_H
|
||||||
|
#define Py_MEMORYOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;
|
||||||
|
#endif
|
||||||
|
PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
|
||||||
|
|
||||||
|
#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type)
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* Get a pointer to the memoryview's private copy of the exporter's buffer. */
|
||||||
|
#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view)
|
||||||
|
/* Get a pointer to the exporting object (this may be NULL!). */
|
||||||
|
#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
|
||||||
|
PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size,
|
||||||
|
int flags);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
|
||||||
|
int buffertype,
|
||||||
|
char order);
|
||||||
|
|
||||||
|
|
||||||
|
/* The structs are declared here so that macros can work, but they shouldn't
|
||||||
|
be considered public. Don't access their fields directly, use the macros
|
||||||
|
and functions instead! */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */
|
||||||
|
#define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
int flags; /* state flags */
|
||||||
|
Py_ssize_t exports; /* number of direct memoryview exports */
|
||||||
|
Py_buffer master; /* snapshot buffer obtained from the original exporter */
|
||||||
|
} _PyManagedBufferObject;
|
||||||
|
|
||||||
|
|
||||||
|
/* memoryview state flags */
|
||||||
|
#define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */
|
||||||
|
#define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */
|
||||||
|
#define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */
|
||||||
|
#define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */
|
||||||
|
#define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
_PyManagedBufferObject *mbuf; /* managed buffer */
|
||||||
|
Py_hash_t hash; /* hash value for read-only views */
|
||||||
|
int flags; /* state flags */
|
||||||
|
Py_ssize_t exports; /* number of buffer re-exports */
|
||||||
|
Py_buffer view; /* private copy of the exporter's view */
|
||||||
|
PyObject *weakreflist;
|
||||||
|
Py_ssize_t ob_array[1]; /* shape, strides, suboffsets */
|
||||||
|
} PyMemoryViewObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_MEMORYOBJECT_H */
|
18
include/python3.5m/metagrammar.h
Normal file
18
include/python3.5m/metagrammar.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef Py_METAGRAMMAR_H
|
||||||
|
#define Py_METAGRAMMAR_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define MSTART 256
|
||||||
|
#define RULE 257
|
||||||
|
#define RHS 258
|
||||||
|
#define ALT 259
|
||||||
|
#define ITEM 260
|
||||||
|
#define ATOM 261
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_METAGRAMMAR_H */
|
94
include/python3.5m/methodobject.h
Normal file
94
include/python3.5m/methodobject.h
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
|
||||||
|
/* Method object interface */
|
||||||
|
|
||||||
|
#ifndef Py_METHODOBJECT_H
|
||||||
|
#define Py_METHODOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is about the type 'builtin_function_or_method',
|
||||||
|
not Python methods in user-defined classes. See classobject.h
|
||||||
|
for the latter. */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCFunction_Type;
|
||||||
|
|
||||||
|
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
|
||||||
|
|
||||||
|
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
|
||||||
|
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
|
||||||
|
PyObject *);
|
||||||
|
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
|
||||||
|
|
||||||
|
/* Macros for direct access to these values. Type checks are *not*
|
||||||
|
done, so use with care. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define PyCFunction_GET_FUNCTION(func) \
|
||||||
|
(((PyCFunctionObject *)func) -> m_ml -> ml_meth)
|
||||||
|
#define PyCFunction_GET_SELF(func) \
|
||||||
|
(((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \
|
||||||
|
NULL : ((PyCFunctionObject *)func) -> m_self)
|
||||||
|
#define PyCFunction_GET_FLAGS(func) \
|
||||||
|
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
struct PyMethodDef {
|
||||||
|
const char *ml_name; /* The name of the built-in function/method */
|
||||||
|
PyCFunction ml_meth; /* The C function that implements it */
|
||||||
|
int ml_flags; /* Combination of METH_xxx flags, which mostly
|
||||||
|
describe the args expected by the C func */
|
||||||
|
const char *ml_doc; /* The __doc__ attribute, or NULL */
|
||||||
|
};
|
||||||
|
typedef struct PyMethodDef PyMethodDef;
|
||||||
|
|
||||||
|
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
|
||||||
|
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
|
||||||
|
PyObject *);
|
||||||
|
|
||||||
|
/* Flag passed to newmethodobject */
|
||||||
|
/* #define METH_OLDARGS 0x0000 -- unsupported now */
|
||||||
|
#define METH_VARARGS 0x0001
|
||||||
|
#define METH_KEYWORDS 0x0002
|
||||||
|
/* METH_NOARGS and METH_O must not be combined with the flags above. */
|
||||||
|
#define METH_NOARGS 0x0004
|
||||||
|
#define METH_O 0x0008
|
||||||
|
|
||||||
|
/* METH_CLASS and METH_STATIC are a little different; these control
|
||||||
|
the construction of methods for a class. These cannot be used for
|
||||||
|
functions in modules. */
|
||||||
|
#define METH_CLASS 0x0010
|
||||||
|
#define METH_STATIC 0x0020
|
||||||
|
|
||||||
|
/* METH_COEXIST allows a method to be entered even though a slot has
|
||||||
|
already filled the entry. When defined, the flag allows a separate
|
||||||
|
method, "__contains__" for example, to coexist with a defined
|
||||||
|
slot like sq_contains. */
|
||||||
|
|
||||||
|
#define METH_COEXIST 0x0040
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyMethodDef *m_ml; /* Description of the C function to call */
|
||||||
|
PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */
|
||||||
|
PyObject *m_module; /* The __module__ attribute, can be anything */
|
||||||
|
PyObject *m_weakreflist; /* List of weak references */
|
||||||
|
} PyCFunctionObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out);
|
||||||
|
PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_METHODOBJECT_H */
|
155
include/python3.5m/modsupport.h
Normal file
155
include/python3.5m/modsupport.h
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
|
||||||
|
#ifndef Py_MODSUPPORT_H
|
||||||
|
#define Py_MODSUPPORT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Module support interface */
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
|
||||||
|
to mean Py_ssize_t */
|
||||||
|
#ifdef PY_SSIZE_T_CLEAN
|
||||||
|
#define PyArg_Parse _PyArg_Parse_SizeT
|
||||||
|
#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
|
||||||
|
#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
|
||||||
|
#define PyArg_VaParse _PyArg_VaParse_SizeT
|
||||||
|
#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
|
||||||
|
#define Py_BuildValue _Py_BuildValue_SizeT
|
||||||
|
#define Py_VaBuildValue _Py_VaBuildValue_SizeT
|
||||||
|
#else
|
||||||
|
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */
|
||||||
|
#if !defined(PY_SSIZE_T_CLEAN) || !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
||||||
|
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
|
||||||
|
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
|
||||||
|
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
|
||||||
|
const char *, char **, ...);
|
||||||
|
PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
|
||||||
|
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
|
||||||
|
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
|
||||||
|
#endif
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw);
|
||||||
|
PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
|
||||||
|
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
|
||||||
|
const char *, char **, va_list);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
|
||||||
|
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
|
||||||
|
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
|
||||||
|
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
|
||||||
|
|
||||||
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
||||||
|
/* New in 3.5 */
|
||||||
|
PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
|
||||||
|
PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
|
||||||
|
PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Py_CLEANUP_SUPPORTED 0x20000
|
||||||
|
|
||||||
|
#define PYTHON_API_VERSION 1013
|
||||||
|
#define PYTHON_API_STRING "1013"
|
||||||
|
/* The API version is maintained (independently from the Python version)
|
||||||
|
so we can detect mismatches between the interpreter and dynamically
|
||||||
|
loaded modules. These are diagnosed by an error message but
|
||||||
|
the module is still loaded (because the mismatch can only be tested
|
||||||
|
after loading the module). The error message is intended to
|
||||||
|
explain the core dump a few seconds later.
|
||||||
|
|
||||||
|
The symbol PYTHON_API_STRING defines the same value as a string
|
||||||
|
literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
|
||||||
|
|
||||||
|
Please add a line or two to the top of this log for each API
|
||||||
|
version change:
|
||||||
|
|
||||||
|
22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
|
||||||
|
|
||||||
|
19-Aug-2002 GvR 1012 Changes to string object struct for
|
||||||
|
interning changes, saving 3 bytes.
|
||||||
|
|
||||||
|
17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
|
||||||
|
|
||||||
|
25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
|
||||||
|
PyFrame_New(); Python 2.1a2
|
||||||
|
|
||||||
|
14-Mar-2000 GvR 1009 Unicode API added
|
||||||
|
|
||||||
|
3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
|
||||||
|
|
||||||
|
3-Dec-1998 GvR 1008 Python 1.5.2b1
|
||||||
|
|
||||||
|
18-Jan-1997 GvR 1007 string interning and other speedups
|
||||||
|
|
||||||
|
11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
|
||||||
|
|
||||||
|
30-Jul-1996 GvR Slice and ellipses syntax added
|
||||||
|
|
||||||
|
23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
|
||||||
|
|
||||||
|
7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
|
||||||
|
|
||||||
|
10-Jan-1995 GvR Renamed globals to new naming scheme
|
||||||
|
|
||||||
|
9-Jan-1995 GvR Initial version (incompatible with older API)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
|
||||||
|
Python 3, it will stay at the value of 3; changes to the limited API
|
||||||
|
must be performed in a strictly backwards-compatible manner. */
|
||||||
|
#define PYTHON_ABI_VERSION 3
|
||||||
|
#define PYTHON_ABI_STRING "3"
|
||||||
|
|
||||||
|
#ifdef Py_TRACE_REFS
|
||||||
|
/* When we are tracing reference counts, rename module creation functions so
|
||||||
|
modules compiled with incompatible settings will generate a
|
||||||
|
link-time error. */
|
||||||
|
#define PyModule_Create2 PyModule_Create2TraceRefs
|
||||||
|
#define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
|
||||||
|
int apiver);
|
||||||
|
|
||||||
|
#ifdef Py_LIMITED_API
|
||||||
|
#define PyModule_Create(module) \
|
||||||
|
PyModule_Create2(module, PYTHON_ABI_VERSION)
|
||||||
|
#else
|
||||||
|
#define PyModule_Create(module) \
|
||||||
|
PyModule_Create2(module, PYTHON_API_VERSION)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
||||||
|
/* New in 3.5 */
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
|
||||||
|
PyObject *spec,
|
||||||
|
int module_api_version);
|
||||||
|
|
||||||
|
#ifdef Py_LIMITED_API
|
||||||
|
#define PyModule_FromDefAndSpec(module, spec) \
|
||||||
|
PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION)
|
||||||
|
#else
|
||||||
|
#define PyModule_FromDefAndSpec(module, spec) \
|
||||||
|
PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
#endif /* New in 3.5 */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_DATA(char *) _Py_PackageContext;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_MODSUPPORT_H */
|
85
include/python3.5m/moduleobject.h
Normal file
85
include/python3.5m/moduleobject.h
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
|
||||||
|
/* Module object interface */
|
||||||
|
|
||||||
|
#ifndef Py_MODULEOBJECT_H
|
||||||
|
#define Py_MODULEOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyModule_Type;
|
||||||
|
|
||||||
|
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
|
||||||
|
#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_NewObject(
|
||||||
|
PyObject *name
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_New(
|
||||||
|
const char *name /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
|
||||||
|
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
|
||||||
|
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
|
||||||
|
PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
|
||||||
|
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
|
||||||
|
|
||||||
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
||||||
|
/* New in 3.5 */
|
||||||
|
PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*);
|
||||||
|
PyAPI_DATA(PyTypeObject) PyModuleDef_Type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct PyModuleDef_Base {
|
||||||
|
PyObject_HEAD
|
||||||
|
PyObject* (*m_init)(void);
|
||||||
|
Py_ssize_t m_index;
|
||||||
|
PyObject* m_copy;
|
||||||
|
} PyModuleDef_Base;
|
||||||
|
|
||||||
|
#define PyModuleDef_HEAD_INIT { \
|
||||||
|
PyObject_HEAD_INIT(NULL) \
|
||||||
|
NULL, /* m_init */ \
|
||||||
|
0, /* m_index */ \
|
||||||
|
NULL, /* m_copy */ \
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PyModuleDef_Slot;
|
||||||
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
||||||
|
/* New in 3.5 */
|
||||||
|
typedef struct PyModuleDef_Slot{
|
||||||
|
int slot;
|
||||||
|
void *value;
|
||||||
|
} PyModuleDef_Slot;
|
||||||
|
|
||||||
|
#define Py_mod_create 1
|
||||||
|
#define Py_mod_exec 2
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#define _Py_mod_LAST_SLOT 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* New in 3.5 */
|
||||||
|
|
||||||
|
typedef struct PyModuleDef{
|
||||||
|
PyModuleDef_Base m_base;
|
||||||
|
const char* m_name;
|
||||||
|
const char* m_doc;
|
||||||
|
Py_ssize_t m_size;
|
||||||
|
PyMethodDef *m_methods;
|
||||||
|
struct PyModuleDef_Slot* m_slots;
|
||||||
|
traverseproc m_traverse;
|
||||||
|
inquiry m_clear;
|
||||||
|
freefunc m_free;
|
||||||
|
}PyModuleDef;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_MODULEOBJECT_H */
|
17
include/python3.5m/namespaceobject.h
Normal file
17
include/python3.5m/namespaceobject.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
/* simple namespace object interface */
|
||||||
|
|
||||||
|
#ifndef NAMESPACEOBJECT_H
|
||||||
|
#define NAMESPACEOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) _PyNamespace_Type;
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !NAMESPACEOBJECT_H */
|
44
include/python3.5m/node.h
Normal file
44
include/python3.5m/node.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
/* Parse tree node interface */
|
||||||
|
|
||||||
|
#ifndef Py_NODE_H
|
||||||
|
#define Py_NODE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct _node {
|
||||||
|
short n_type;
|
||||||
|
char *n_str;
|
||||||
|
int n_lineno;
|
||||||
|
int n_col_offset;
|
||||||
|
int n_nchildren;
|
||||||
|
struct _node *n_child;
|
||||||
|
} node;
|
||||||
|
|
||||||
|
PyAPI_FUNC(node *) PyNode_New(int type);
|
||||||
|
PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
|
||||||
|
char *str, int lineno, int col_offset);
|
||||||
|
PyAPI_FUNC(void) PyNode_Free(node *n);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Node access functions */
|
||||||
|
#define NCH(n) ((n)->n_nchildren)
|
||||||
|
|
||||||
|
#define CHILD(n, i) (&(n)->n_child[i])
|
||||||
|
#define RCHILD(n, i) (CHILD(n, NCH(n) + i))
|
||||||
|
#define TYPE(n) ((n)->n_type)
|
||||||
|
#define STR(n) ((n)->n_str)
|
||||||
|
#define LINENO(n) ((n)->n_lineno)
|
||||||
|
|
||||||
|
/* Assert that the type of a node is what we expect */
|
||||||
|
#define REQ(n, type) assert(TYPE(n) == (type))
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyNode_ListTree(node *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_NODE_H */
|
1028
include/python3.5m/object.h
Normal file
1028
include/python3.5m/object.h
Normal file
File diff suppressed because it is too large
Load diff
363
include/python3.5m/objimpl.h
Normal file
363
include/python3.5m/objimpl.h
Normal file
|
@ -0,0 +1,363 @@
|
||||||
|
/* The PyObject_ memory family: high-level object memory interfaces.
|
||||||
|
See pymem.h for the low-level PyMem_ family.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_OBJIMPL_H
|
||||||
|
#define Py_OBJIMPL_H
|
||||||
|
|
||||||
|
#include "pymem.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BEWARE:
|
||||||
|
|
||||||
|
Each interface exports both functions and macros. Extension modules should
|
||||||
|
use the functions, to ensure binary compatibility across Python versions.
|
||||||
|
Because the Python implementation is free to change internal details, and
|
||||||
|
the macros may (or may not) expose details for speed, if you do use the
|
||||||
|
macros you must recompile your extensions with each Python release.
|
||||||
|
|
||||||
|
Never mix calls to PyObject_ memory functions with calls to the platform
|
||||||
|
malloc/realloc/ calloc/free, or with calls to PyMem_.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Functions and macros for modules that implement new object types.
|
||||||
|
|
||||||
|
- PyObject_New(type, typeobj) allocates memory for a new object of the given
|
||||||
|
type, and initializes part of it. 'type' must be the C structure type used
|
||||||
|
to represent the object, and 'typeobj' the address of the corresponding
|
||||||
|
type object. Reference count and type pointer are filled in; the rest of
|
||||||
|
the bytes of the object are *undefined*! The resulting expression type is
|
||||||
|
'type *'. The size of the object is determined by the tp_basicsize field
|
||||||
|
of the type object.
|
||||||
|
|
||||||
|
- PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size
|
||||||
|
object with room for n items. In addition to the refcount and type pointer
|
||||||
|
fields, this also fills in the ob_size field.
|
||||||
|
|
||||||
|
- PyObject_Del(op) releases the memory allocated for an object. It does not
|
||||||
|
run a destructor -- it only frees the memory. PyObject_Free is identical.
|
||||||
|
|
||||||
|
- PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't
|
||||||
|
allocate memory. Instead of a 'type' parameter, they take a pointer to a
|
||||||
|
new object (allocated by an arbitrary allocator), and initialize its object
|
||||||
|
header fields.
|
||||||
|
|
||||||
|
Note that objects created with PyObject_{New, NewVar} are allocated using the
|
||||||
|
specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is
|
||||||
|
enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG
|
||||||
|
is also #defined.
|
||||||
|
|
||||||
|
In case a specific form of memory management is needed (for example, if you
|
||||||
|
must use the platform malloc heap(s), or shared memory, or C++ local storage or
|
||||||
|
operator new), you must first allocate the object with your custom allocator,
|
||||||
|
then pass its pointer to PyObject_{Init, InitVar} for filling in its Python-
|
||||||
|
specific fields: reference count, type pointer, possibly others. You should
|
||||||
|
be aware that Python no control over these objects because they don't
|
||||||
|
cooperate with the Python memory manager. Such objects may not be eligible
|
||||||
|
for automatic garbage collection and you have to make sure that they are
|
||||||
|
released accordingly whenever their destructor gets called (cf. the specific
|
||||||
|
form of memory management you're using).
|
||||||
|
|
||||||
|
Unless you have specific memory management requirements, use
|
||||||
|
PyObject_{New, NewVar, Del}.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Raw object memory interface
|
||||||
|
* ===========================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Functions to call the same malloc/realloc/free as used by Python's
|
||||||
|
object allocator. If WITH_PYMALLOC is enabled, these may differ from
|
||||||
|
the platform malloc/realloc/free. The Python object allocator is
|
||||||
|
designed for fast, cache-conscious allocation of many "small" objects,
|
||||||
|
and with low hidden memory overhead.
|
||||||
|
|
||||||
|
PyObject_Malloc(0) returns a unique non-NULL pointer if possible.
|
||||||
|
|
||||||
|
PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n).
|
||||||
|
PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory
|
||||||
|
at p.
|
||||||
|
|
||||||
|
Returned pointers must be checked for NULL explicitly; no action is
|
||||||
|
performed on failure other than to return NULL (no warning it printed, no
|
||||||
|
exception is set, etc).
|
||||||
|
|
||||||
|
For allocating objects, use PyObject_{New, NewVar} instead whenever
|
||||||
|
possible. The PyObject_{Malloc, Realloc, Free} family is exposed
|
||||||
|
so that you can exploit Python's small-block allocator for non-object
|
||||||
|
uses. If you must use these routines to allocate object memory, make sure
|
||||||
|
the object gets initialized via PyObject_{Init, InitVar} after obtaining
|
||||||
|
the raw memory.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(void *) PyObject_Malloc(size_t size);
|
||||||
|
PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize);
|
||||||
|
PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size);
|
||||||
|
PyAPI_FUNC(void) PyObject_Free(void *ptr);
|
||||||
|
|
||||||
|
/* This function returns the number of allocated memory blocks, regardless of size */
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
|
||||||
|
|
||||||
|
/* Macros */
|
||||||
|
#ifdef WITH_PYMALLOC
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out);
|
||||||
|
#endif /* #ifndef Py_LIMITED_API */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Macros */
|
||||||
|
#define PyObject_MALLOC PyObject_Malloc
|
||||||
|
#define PyObject_REALLOC PyObject_Realloc
|
||||||
|
#define PyObject_FREE PyObject_Free
|
||||||
|
#define PyObject_Del PyObject_Free
|
||||||
|
#define PyObject_DEL PyObject_Free
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic object allocator interface
|
||||||
|
* ==================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
|
||||||
|
PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *,
|
||||||
|
PyTypeObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
|
||||||
|
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
|
||||||
|
|
||||||
|
#define PyObject_New(type, typeobj) \
|
||||||
|
( (type *) _PyObject_New(typeobj) )
|
||||||
|
#define PyObject_NewVar(type, typeobj, n) \
|
||||||
|
( (type *) _PyObject_NewVar((typeobj), (n)) )
|
||||||
|
|
||||||
|
/* Macros trading binary compatibility for speed. See also pymem.h.
|
||||||
|
Note that these macros expect non-NULL object pointers.*/
|
||||||
|
#define PyObject_INIT(op, typeobj) \
|
||||||
|
( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
|
||||||
|
#define PyObject_INIT_VAR(op, typeobj, size) \
|
||||||
|
( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
|
||||||
|
|
||||||
|
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
|
||||||
|
|
||||||
|
/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a
|
||||||
|
vrbl-size object with nitems items, exclusive of gc overhead (if any). The
|
||||||
|
value is rounded up to the closest multiple of sizeof(void *), in order to
|
||||||
|
ensure that pointer fields at the end of the object are correctly aligned
|
||||||
|
for the platform (this is of special importance for subclasses of, e.g.,
|
||||||
|
str or int, so that pointers can be stored after the embedded data).
|
||||||
|
|
||||||
|
Note that there's no memory wastage in doing this, as malloc has to
|
||||||
|
return (at worst) pointer-aligned memory anyway.
|
||||||
|
*/
|
||||||
|
#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0
|
||||||
|
# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _PyObject_VAR_SIZE(typeobj, nitems) \
|
||||||
|
_Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \
|
||||||
|
(nitems)*(typeobj)->tp_itemsize, \
|
||||||
|
SIZEOF_VOID_P)
|
||||||
|
|
||||||
|
#define PyObject_NEW(type, typeobj) \
|
||||||
|
( (type *) PyObject_Init( \
|
||||||
|
(PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) )
|
||||||
|
|
||||||
|
#define PyObject_NEW_VAR(type, typeobj, n) \
|
||||||
|
( (type *) PyObject_InitVar( \
|
||||||
|
(PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\
|
||||||
|
(typeobj), (n)) )
|
||||||
|
|
||||||
|
/* This example code implements an object constructor with a custom
|
||||||
|
allocator, where PyObject_New is inlined, and shows the important
|
||||||
|
distinction between two steps (at least):
|
||||||
|
1) the actual allocation of the object storage;
|
||||||
|
2) the initialization of the Python specific fields
|
||||||
|
in this storage with PyObject_{Init, InitVar}.
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
YourObject_New(...)
|
||||||
|
{
|
||||||
|
PyObject *op;
|
||||||
|
|
||||||
|
op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct));
|
||||||
|
if (op == NULL)
|
||||||
|
return PyErr_NoMemory();
|
||||||
|
|
||||||
|
PyObject_Init(op, &YourTypeStruct);
|
||||||
|
|
||||||
|
op->ob_field = value;
|
||||||
|
...
|
||||||
|
return op;
|
||||||
|
}
|
||||||
|
|
||||||
|
Note that in C++, the use of the new operator usually implies that
|
||||||
|
the 1st step is performed automatically for you, so in a C++ class
|
||||||
|
constructor you would start directly with PyObject_Init/InitVar
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
/* user context passed as the first argument to the 2 functions */
|
||||||
|
void *ctx;
|
||||||
|
|
||||||
|
/* allocate an arena of size bytes */
|
||||||
|
void* (*alloc) (void *ctx, size_t size);
|
||||||
|
|
||||||
|
/* free an arena */
|
||||||
|
void (*free) (void *ctx, void *ptr, size_t size);
|
||||||
|
} PyObjectArenaAllocator;
|
||||||
|
|
||||||
|
/* Get the arena allocator. */
|
||||||
|
PyAPI_FUNC(void) PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator);
|
||||||
|
|
||||||
|
/* Set the arena allocator. */
|
||||||
|
PyAPI_FUNC(void) PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Garbage Collection Support
|
||||||
|
* ==========================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* C equivalent of gc.collect(). */
|
||||||
|
PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(Py_ssize_t) _PyGC_CollectNoFail(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Test if a type has a GC head */
|
||||||
|
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
|
||||||
|
|
||||||
|
/* Test if an object has a GC head */
|
||||||
|
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
|
||||||
|
(Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
|
||||||
|
#define PyObject_GC_Resize(type, op, n) \
|
||||||
|
( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
|
||||||
|
|
||||||
|
/* GC information is stored BEFORE the object structure. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef union _gc_head {
|
||||||
|
struct {
|
||||||
|
union _gc_head *gc_next;
|
||||||
|
union _gc_head *gc_prev;
|
||||||
|
Py_ssize_t gc_refs;
|
||||||
|
} gc;
|
||||||
|
double dummy; /* force worst-case alignment */
|
||||||
|
} PyGC_Head;
|
||||||
|
|
||||||
|
extern PyGC_Head *_PyGC_generation0;
|
||||||
|
|
||||||
|
#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1)
|
||||||
|
|
||||||
|
/* Bit 0 is set when tp_finalize is called */
|
||||||
|
#define _PyGC_REFS_MASK_FINALIZED (1 << 0)
|
||||||
|
/* The (N-1) most significant bits contain the gc state / refcount */
|
||||||
|
#define _PyGC_REFS_SHIFT (1)
|
||||||
|
#define _PyGC_REFS_MASK (((size_t) -1) << _PyGC_REFS_SHIFT)
|
||||||
|
|
||||||
|
#define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT)
|
||||||
|
#define _PyGCHead_SET_REFS(g, v) do { \
|
||||||
|
(g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) \
|
||||||
|
| (((size_t)(v)) << _PyGC_REFS_SHIFT); \
|
||||||
|
} while (0)
|
||||||
|
#define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT)
|
||||||
|
|
||||||
|
#define _PyGCHead_FINALIZED(g) (((g)->gc.gc_refs & _PyGC_REFS_MASK_FINALIZED) != 0)
|
||||||
|
#define _PyGCHead_SET_FINALIZED(g, v) do { \
|
||||||
|
(g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK_FINALIZED) \
|
||||||
|
| (v != 0); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define _PyGC_FINALIZED(o) _PyGCHead_FINALIZED(_Py_AS_GC(o))
|
||||||
|
#define _PyGC_SET_FINALIZED(o, v) _PyGCHead_SET_FINALIZED(_Py_AS_GC(o), v)
|
||||||
|
|
||||||
|
#define _PyGC_REFS(o) _PyGCHead_REFS(_Py_AS_GC(o))
|
||||||
|
|
||||||
|
#define _PyGC_REFS_UNTRACKED (-2)
|
||||||
|
#define _PyGC_REFS_REACHABLE (-3)
|
||||||
|
#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4)
|
||||||
|
|
||||||
|
/* Tell the GC to track this object. NB: While the object is tracked the
|
||||||
|
* collector it must be safe to call the ob_traverse method. */
|
||||||
|
#define _PyObject_GC_TRACK(o) do { \
|
||||||
|
PyGC_Head *g = _Py_AS_GC(o); \
|
||||||
|
if (_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED) \
|
||||||
|
Py_FatalError("GC object already tracked"); \
|
||||||
|
_PyGCHead_SET_REFS(g, _PyGC_REFS_REACHABLE); \
|
||||||
|
g->gc.gc_next = _PyGC_generation0; \
|
||||||
|
g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \
|
||||||
|
g->gc.gc_prev->gc.gc_next = g; \
|
||||||
|
_PyGC_generation0->gc.gc_prev = g; \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
/* Tell the GC to stop tracking this object.
|
||||||
|
* gc_next doesn't need to be set to NULL, but doing so is a good
|
||||||
|
* way to provoke memory errors if calling code is confused.
|
||||||
|
*/
|
||||||
|
#define _PyObject_GC_UNTRACK(o) do { \
|
||||||
|
PyGC_Head *g = _Py_AS_GC(o); \
|
||||||
|
assert(_PyGCHead_REFS(g) != _PyGC_REFS_UNTRACKED); \
|
||||||
|
_PyGCHead_SET_REFS(g, _PyGC_REFS_UNTRACKED); \
|
||||||
|
g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \
|
||||||
|
g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \
|
||||||
|
g->gc.gc_next = NULL; \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
/* True if the object is currently tracked by the GC. */
|
||||||
|
#define _PyObject_GC_IS_TRACKED(o) \
|
||||||
|
(_PyGC_REFS(o) != _PyGC_REFS_UNTRACKED)
|
||||||
|
|
||||||
|
/* True if the object may be tracked by the GC in the future, or already is.
|
||||||
|
This can be useful to implement some optimizations. */
|
||||||
|
#define _PyObject_GC_MAY_BE_TRACKED(obj) \
|
||||||
|
(PyObject_IS_GC(obj) && \
|
||||||
|
(!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
|
||||||
|
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(void) PyObject_GC_Track(void *);
|
||||||
|
PyAPI_FUNC(void) PyObject_GC_UnTrack(void *);
|
||||||
|
PyAPI_FUNC(void) PyObject_GC_Del(void *);
|
||||||
|
|
||||||
|
#define PyObject_GC_New(type, typeobj) \
|
||||||
|
( (type *) _PyObject_GC_New(typeobj) )
|
||||||
|
#define PyObject_GC_NewVar(type, typeobj, n) \
|
||||||
|
( (type *) _PyObject_GC_NewVar((typeobj), (n)) )
|
||||||
|
|
||||||
|
|
||||||
|
/* Utility macro to help write tp_traverse functions.
|
||||||
|
* To use this macro, the tp_traverse function must name its arguments
|
||||||
|
* "visit" and "arg". This is intended to keep tp_traverse functions
|
||||||
|
* looking as much alike as possible.
|
||||||
|
*/
|
||||||
|
#define Py_VISIT(op) \
|
||||||
|
do { \
|
||||||
|
if (op) { \
|
||||||
|
int vret = visit((PyObject *)(op), arg); \
|
||||||
|
if (vret) \
|
||||||
|
return vret; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Test if a type supports weak references */
|
||||||
|
#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
|
||||||
|
|
||||||
|
#define PyObject_GET_WEAKREFS_LISTPTR(o) \
|
||||||
|
((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_OBJIMPL_H */
|
43
include/python3.5m/odictobject.h
Normal file
43
include/python3.5m/odictobject.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#ifndef Py_ODICTOBJECT_H
|
||||||
|
#define Py_ODICTOBJECT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* OrderedDict */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
|
||||||
|
typedef struct _odictobject PyODictObject;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyODict_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyODictIter_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyODictItems_Type;
|
||||||
|
PyAPI_DATA(PyTypeObject) PyODictValues_Type;
|
||||||
|
|
||||||
|
#endif /* Py_LIMITED_API */
|
||||||
|
|
||||||
|
#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
|
||||||
|
#define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type)
|
||||||
|
#define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used
|
||||||
|
#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key)
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyODict_New(void);
|
||||||
|
PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item);
|
||||||
|
PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key);
|
||||||
|
|
||||||
|
/* wrappers around PyDict* functions */
|
||||||
|
#define PyODict_GetItem(od, key) PyDict_GetItem((PyObject *)od, key)
|
||||||
|
#define PyODict_GetItemWithError(od, key) \
|
||||||
|
PyDict_GetItemWithError((PyObject *)od, key)
|
||||||
|
#define PyODict_Contains(od, key) PyDict_Contains((PyObject *)od, key)
|
||||||
|
#define PyODict_Size(od) PyDict_Size((PyObject *)od)
|
||||||
|
#define PyODict_GetItemString(od, key) \
|
||||||
|
PyDict_GetItemString((PyObject *)od, key)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_ODICTOBJECT_H */
|
142
include/python3.5m/opcode.h
Normal file
142
include/python3.5m/opcode.h
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/* Auto-generated by Tools/scripts/generate_opcode_h.py */
|
||||||
|
#ifndef Py_OPCODE_H
|
||||||
|
#define Py_OPCODE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Instruction opcodes for compiled code */
|
||||||
|
#define POP_TOP 1
|
||||||
|
#define ROT_TWO 2
|
||||||
|
#define ROT_THREE 3
|
||||||
|
#define DUP_TOP 4
|
||||||
|
#define DUP_TOP_TWO 5
|
||||||
|
#define NOP 9
|
||||||
|
#define UNARY_POSITIVE 10
|
||||||
|
#define UNARY_NEGATIVE 11
|
||||||
|
#define UNARY_NOT 12
|
||||||
|
#define UNARY_INVERT 15
|
||||||
|
#define BINARY_MATRIX_MULTIPLY 16
|
||||||
|
#define INPLACE_MATRIX_MULTIPLY 17
|
||||||
|
#define BINARY_POWER 19
|
||||||
|
#define BINARY_MULTIPLY 20
|
||||||
|
#define BINARY_MODULO 22
|
||||||
|
#define BINARY_ADD 23
|
||||||
|
#define BINARY_SUBTRACT 24
|
||||||
|
#define BINARY_SUBSCR 25
|
||||||
|
#define BINARY_FLOOR_DIVIDE 26
|
||||||
|
#define BINARY_TRUE_DIVIDE 27
|
||||||
|
#define INPLACE_FLOOR_DIVIDE 28
|
||||||
|
#define INPLACE_TRUE_DIVIDE 29
|
||||||
|
#define GET_AITER 50
|
||||||
|
#define GET_ANEXT 51
|
||||||
|
#define BEFORE_ASYNC_WITH 52
|
||||||
|
#define INPLACE_ADD 55
|
||||||
|
#define INPLACE_SUBTRACT 56
|
||||||
|
#define INPLACE_MULTIPLY 57
|
||||||
|
#define INPLACE_MODULO 59
|
||||||
|
#define STORE_SUBSCR 60
|
||||||
|
#define DELETE_SUBSCR 61
|
||||||
|
#define BINARY_LSHIFT 62
|
||||||
|
#define BINARY_RSHIFT 63
|
||||||
|
#define BINARY_AND 64
|
||||||
|
#define BINARY_XOR 65
|
||||||
|
#define BINARY_OR 66
|
||||||
|
#define INPLACE_POWER 67
|
||||||
|
#define GET_ITER 68
|
||||||
|
#define GET_YIELD_FROM_ITER 69
|
||||||
|
#define PRINT_EXPR 70
|
||||||
|
#define LOAD_BUILD_CLASS 71
|
||||||
|
#define YIELD_FROM 72
|
||||||
|
#define GET_AWAITABLE 73
|
||||||
|
#define INPLACE_LSHIFT 75
|
||||||
|
#define INPLACE_RSHIFT 76
|
||||||
|
#define INPLACE_AND 77
|
||||||
|
#define INPLACE_XOR 78
|
||||||
|
#define INPLACE_OR 79
|
||||||
|
#define BREAK_LOOP 80
|
||||||
|
#define WITH_CLEANUP_START 81
|
||||||
|
#define WITH_CLEANUP_FINISH 82
|
||||||
|
#define RETURN_VALUE 83
|
||||||
|
#define IMPORT_STAR 84
|
||||||
|
#define YIELD_VALUE 86
|
||||||
|
#define POP_BLOCK 87
|
||||||
|
#define END_FINALLY 88
|
||||||
|
#define POP_EXCEPT 89
|
||||||
|
#define HAVE_ARGUMENT 90
|
||||||
|
#define STORE_NAME 90
|
||||||
|
#define DELETE_NAME 91
|
||||||
|
#define UNPACK_SEQUENCE 92
|
||||||
|
#define FOR_ITER 93
|
||||||
|
#define UNPACK_EX 94
|
||||||
|
#define STORE_ATTR 95
|
||||||
|
#define DELETE_ATTR 96
|
||||||
|
#define STORE_GLOBAL 97
|
||||||
|
#define DELETE_GLOBAL 98
|
||||||
|
#define LOAD_CONST 100
|
||||||
|
#define LOAD_NAME 101
|
||||||
|
#define BUILD_TUPLE 102
|
||||||
|
#define BUILD_LIST 103
|
||||||
|
#define BUILD_SET 104
|
||||||
|
#define BUILD_MAP 105
|
||||||
|
#define LOAD_ATTR 106
|
||||||
|
#define COMPARE_OP 107
|
||||||
|
#define IMPORT_NAME 108
|
||||||
|
#define IMPORT_FROM 109
|
||||||
|
#define JUMP_FORWARD 110
|
||||||
|
#define JUMP_IF_FALSE_OR_POP 111
|
||||||
|
#define JUMP_IF_TRUE_OR_POP 112
|
||||||
|
#define JUMP_ABSOLUTE 113
|
||||||
|
#define POP_JUMP_IF_FALSE 114
|
||||||
|
#define POP_JUMP_IF_TRUE 115
|
||||||
|
#define LOAD_GLOBAL 116
|
||||||
|
#define CONTINUE_LOOP 119
|
||||||
|
#define SETUP_LOOP 120
|
||||||
|
#define SETUP_EXCEPT 121
|
||||||
|
#define SETUP_FINALLY 122
|
||||||
|
#define LOAD_FAST 124
|
||||||
|
#define STORE_FAST 125
|
||||||
|
#define DELETE_FAST 126
|
||||||
|
#define RAISE_VARARGS 130
|
||||||
|
#define CALL_FUNCTION 131
|
||||||
|
#define MAKE_FUNCTION 132
|
||||||
|
#define BUILD_SLICE 133
|
||||||
|
#define MAKE_CLOSURE 134
|
||||||
|
#define LOAD_CLOSURE 135
|
||||||
|
#define LOAD_DEREF 136
|
||||||
|
#define STORE_DEREF 137
|
||||||
|
#define DELETE_DEREF 138
|
||||||
|
#define CALL_FUNCTION_VAR 140
|
||||||
|
#define CALL_FUNCTION_KW 141
|
||||||
|
#define CALL_FUNCTION_VAR_KW 142
|
||||||
|
#define SETUP_WITH 143
|
||||||
|
#define EXTENDED_ARG 144
|
||||||
|
#define LIST_APPEND 145
|
||||||
|
#define SET_ADD 146
|
||||||
|
#define MAP_ADD 147
|
||||||
|
#define LOAD_CLASSDEREF 148
|
||||||
|
#define BUILD_LIST_UNPACK 149
|
||||||
|
#define BUILD_MAP_UNPACK 150
|
||||||
|
#define BUILD_MAP_UNPACK_WITH_CALL 151
|
||||||
|
#define BUILD_TUPLE_UNPACK 152
|
||||||
|
#define BUILD_SET_UNPACK 153
|
||||||
|
#define SETUP_ASYNC_WITH 154
|
||||||
|
|
||||||
|
/* EXCEPT_HANDLER is a special, implicit block type which is created when
|
||||||
|
entering an except handler. It is not an opcode but we define it here
|
||||||
|
as we want it to be available to both frameobject.c and ceval.c, while
|
||||||
|
remaining private.*/
|
||||||
|
#define EXCEPT_HANDLER 257
|
||||||
|
|
||||||
|
|
||||||
|
enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE,
|
||||||
|
PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, PyCmp_IN, PyCmp_NOT_IN,
|
||||||
|
PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
|
||||||
|
|
||||||
|
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_OPCODE_H */
|
47
include/python3.5m/osdefs.h
Normal file
47
include/python3.5m/osdefs.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#ifndef Py_OSDEFS_H
|
||||||
|
#define Py_OSDEFS_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Operating system dependencies */
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
#define SEP L'\\'
|
||||||
|
#define ALTSEP L'/'
|
||||||
|
#define MAXPATHLEN 256
|
||||||
|
#define DELIM L';'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Filename separator */
|
||||||
|
#ifndef SEP
|
||||||
|
#define SEP L'/'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Max pathname length */
|
||||||
|
#ifdef __hpux
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
#define PATH_MAX MAXPATHLEN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAXPATHLEN
|
||||||
|
#if defined(PATH_MAX) && PATH_MAX > 1024
|
||||||
|
#define MAXPATHLEN PATH_MAX
|
||||||
|
#else
|
||||||
|
#define MAXPATHLEN 1024
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Search path entry delimiter */
|
||||||
|
#ifndef DELIM
|
||||||
|
#define DELIM L':'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_OSDEFS_H */
|
108
include/python3.5m/parsetok.h
Normal file
108
include/python3.5m/parsetok.h
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
|
||||||
|
/* Parser-tokenizer link interface */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_PARSETOK_H
|
||||||
|
#define Py_PARSETOK_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int error;
|
||||||
|
#ifndef PGEN
|
||||||
|
/* The filename is useless for pgen, see comment in tok_state structure */
|
||||||
|
PyObject *filename;
|
||||||
|
#endif
|
||||||
|
int lineno;
|
||||||
|
int offset;
|
||||||
|
char *text; /* UTF-8-encoded string */
|
||||||
|
int token;
|
||||||
|
int expected;
|
||||||
|
} perrdetail;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define PyPARSE_YIELD_IS_KEYWORD 0x0001
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PyPARSE_DONT_IMPLY_DEDENT 0x0002
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define PyPARSE_WITH_IS_KEYWORD 0x0003
|
||||||
|
#define PyPARSE_PRINT_IS_FUNCTION 0x0004
|
||||||
|
#define PyPARSE_UNICODE_LITERALS 0x0008
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PyPARSE_IGNORE_COOKIE 0x0010
|
||||||
|
#define PyPARSE_BARRY_AS_BDFL 0x0020
|
||||||
|
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
|
||||||
|
perrdetail *);
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
|
||||||
|
const char *, const char *,
|
||||||
|
perrdetail *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
|
||||||
|
perrdetail *, int);
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseFileFlags(
|
||||||
|
FILE *fp,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
const char *enc,
|
||||||
|
grammar *g,
|
||||||
|
int start,
|
||||||
|
const char *ps1,
|
||||||
|
const char *ps2,
|
||||||
|
perrdetail *err_ret,
|
||||||
|
int flags);
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
|
||||||
|
FILE *fp,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
const char *enc,
|
||||||
|
grammar *g,
|
||||||
|
int start,
|
||||||
|
const char *ps1,
|
||||||
|
const char *ps2,
|
||||||
|
perrdetail *err_ret,
|
||||||
|
int *flags);
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseFileObject(
|
||||||
|
FILE *fp,
|
||||||
|
PyObject *filename,
|
||||||
|
const char *enc,
|
||||||
|
grammar *g,
|
||||||
|
int start,
|
||||||
|
const char *ps1,
|
||||||
|
const char *ps2,
|
||||||
|
perrdetail *err_ret,
|
||||||
|
int *flags);
|
||||||
|
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(
|
||||||
|
const char *s,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
grammar *g,
|
||||||
|
int start,
|
||||||
|
perrdetail *err_ret,
|
||||||
|
int flags);
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(
|
||||||
|
const char *s,
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
grammar *g,
|
||||||
|
int start,
|
||||||
|
perrdetail *err_ret,
|
||||||
|
int *flags);
|
||||||
|
PyAPI_FUNC(node *) PyParser_ParseStringObject(
|
||||||
|
const char *s,
|
||||||
|
PyObject *filename,
|
||||||
|
grammar *g,
|
||||||
|
int start,
|
||||||
|
perrdetail *err_ret,
|
||||||
|
int *flags);
|
||||||
|
|
||||||
|
/* Note that the following functions are defined in pythonrun.c,
|
||||||
|
not in parsetok.c */
|
||||||
|
PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
|
||||||
|
PyAPI_FUNC(void) PyParser_ClearError(perrdetail *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PARSETOK_H */
|
||||||
|
#endif /* !Py_LIMITED_API */
|
35
include/python3.5m/patchlevel.h
Normal file
35
include/python3.5m/patchlevel.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
/* Python version identification scheme.
|
||||||
|
|
||||||
|
When the major or minor version changes, the VERSION variable in
|
||||||
|
configure.ac must also be changed.
|
||||||
|
|
||||||
|
There is also (independent) API version information in modsupport.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Values for PY_RELEASE_LEVEL */
|
||||||
|
#define PY_RELEASE_LEVEL_ALPHA 0xA
|
||||||
|
#define PY_RELEASE_LEVEL_BETA 0xB
|
||||||
|
#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */
|
||||||
|
#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */
|
||||||
|
/* Higher for patch releases */
|
||||||
|
|
||||||
|
/* Version parsed out into numeric values */
|
||||||
|
/*--start constants--*/
|
||||||
|
#define PY_MAJOR_VERSION 3
|
||||||
|
#define PY_MINOR_VERSION 5
|
||||||
|
#define PY_MICRO_VERSION 0
|
||||||
|
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
|
||||||
|
#define PY_RELEASE_SERIAL 0
|
||||||
|
|
||||||
|
/* Version as a string */
|
||||||
|
#define PY_VERSION "3.5.0"
|
||||||
|
/*--end constants--*/
|
||||||
|
|
||||||
|
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
|
||||||
|
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
|
||||||
|
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
|
||||||
|
(PY_MINOR_VERSION << 16) | \
|
||||||
|
(PY_MICRO_VERSION << 8) | \
|
||||||
|
(PY_RELEASE_LEVEL << 4) | \
|
||||||
|
(PY_RELEASE_SERIAL << 0))
|
18
include/python3.5m/pgen.h
Normal file
18
include/python3.5m/pgen.h
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef Py_PGEN_H
|
||||||
|
#define Py_PGEN_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Parser generator interface */
|
||||||
|
|
||||||
|
extern grammar *meta_grammar(void);
|
||||||
|
|
||||||
|
struct _node;
|
||||||
|
extern grammar *pgen(struct _node *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PGEN_H */
|
42
include/python3.5m/pgenheaders.h
Normal file
42
include/python3.5m/pgenheaders.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef Py_PGENHEADERS_H
|
||||||
|
#define Py_PGENHEADERS_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Include files and extern declarations used by most of the parser. */
|
||||||
|
|
||||||
|
#include "Python.h"
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||||
|
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||||
|
|
||||||
|
#define addarc _Py_addarc
|
||||||
|
#define addbit _Py_addbit
|
||||||
|
#define adddfa _Py_adddfa
|
||||||
|
#define addfirstsets _Py_addfirstsets
|
||||||
|
#define addlabel _Py_addlabel
|
||||||
|
#define addstate _Py_addstate
|
||||||
|
#define delbitset _Py_delbitset
|
||||||
|
#define dumptree _Py_dumptree
|
||||||
|
#define findlabel _Py_findlabel
|
||||||
|
#define mergebitset _Py_mergebitset
|
||||||
|
#define meta_grammar _Py_meta_grammar
|
||||||
|
#define newbitset _Py_newbitset
|
||||||
|
#define newgrammar _Py_newgrammar
|
||||||
|
#define pgen _Py_pgen
|
||||||
|
#define printgrammar _Py_printgrammar
|
||||||
|
#define printnonterminals _Py_printnonterminals
|
||||||
|
#define printtree _Py_printtree
|
||||||
|
#define samebitset _Py_samebitset
|
||||||
|
#define showtree _Py_showtree
|
||||||
|
#define tok_dump _Py_tok_dump
|
||||||
|
#define translatelabels _Py_translatelabels
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PGENHEADERS_H */
|
177
include/python3.5m/py_curses.h
Normal file
177
include/python3.5m/py_curses.h
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
|
||||||
|
#ifndef Py_CURSES_H
|
||||||
|
#define Py_CURSES_H
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
/*
|
||||||
|
** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards
|
||||||
|
** against multiple definition of wchar_t.
|
||||||
|
*/
|
||||||
|
#ifdef _BSD_WCHAR_T_DEFINED_
|
||||||
|
#define _WCHAR_T
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* the following define is necessary for OS X 10.6; without it, the
|
||||||
|
Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
|
||||||
|
can't get at the WINDOW flags field. */
|
||||||
|
#define NCURSES_OPAQUE 0
|
||||||
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
/*
|
||||||
|
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
|
||||||
|
** against multiple definition of wchar_t and wint_t.
|
||||||
|
*/
|
||||||
|
#ifdef _XOPEN_SOURCE_EXTENDED
|
||||||
|
#ifndef __FreeBSD_version
|
||||||
|
#include <osreldate.h>
|
||||||
|
#endif
|
||||||
|
#if __FreeBSD_version >= 500000
|
||||||
|
#ifndef __wchar_t
|
||||||
|
#define __wchar_t
|
||||||
|
#endif
|
||||||
|
#ifndef __wint_t
|
||||||
|
#define __wint_t
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifndef _WCHAR_T
|
||||||
|
#define _WCHAR_T
|
||||||
|
#endif
|
||||||
|
#ifndef _WINT_T
|
||||||
|
#define _WINT_T
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NCURSES_H
|
||||||
|
#include <ncurses.h>
|
||||||
|
#else
|
||||||
|
#include <curses.h>
|
||||||
|
#ifdef HAVE_TERM_H
|
||||||
|
/* for tigetstr, which is not declared in SysV curses */
|
||||||
|
#include <term.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NCURSES_H
|
||||||
|
/* configure was checking <curses.h>, but we will
|
||||||
|
use <ncurses.h>, which has all these features. */
|
||||||
|
#ifndef WINDOW_HAS_FLAGS
|
||||||
|
#define WINDOW_HAS_FLAGS 1
|
||||||
|
#endif
|
||||||
|
#ifndef MVWDELCH_IS_EXPRESSION
|
||||||
|
#define MVWDELCH_IS_EXPRESSION 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PyCurses_API_pointers 4
|
||||||
|
|
||||||
|
/* Type declarations */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
WINDOW *win;
|
||||||
|
char *encoding;
|
||||||
|
} PyCursesWindowObject;
|
||||||
|
|
||||||
|
#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type)
|
||||||
|
|
||||||
|
#define PyCurses_CAPSULE_NAME "_curses._C_API"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CURSES_MODULE
|
||||||
|
/* This section is used when compiling _cursesmodule.c */
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* This section is used in modules that use the _cursesmodule API */
|
||||||
|
|
||||||
|
static void **PyCurses_API;
|
||||||
|
|
||||||
|
#define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0])
|
||||||
|
#define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;}
|
||||||
|
#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;}
|
||||||
|
#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;}
|
||||||
|
|
||||||
|
#define import_curses() \
|
||||||
|
PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* general error messages */
|
||||||
|
static char *catchall_ERR = "curses function returned ERR";
|
||||||
|
static char *catchall_NULL = "curses function returned NULL";
|
||||||
|
|
||||||
|
/* Function Prototype Macros - They are ugly but very, very useful. ;-)
|
||||||
|
|
||||||
|
X - function name
|
||||||
|
TYPE - parameter Type
|
||||||
|
ERGSTR - format string for construction of the return value
|
||||||
|
PARSESTR - format string for argument parsing
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NoArgNoReturnFunction(X) \
|
||||||
|
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||||
|
{ \
|
||||||
|
PyCursesInitialised \
|
||||||
|
return PyCursesCheckERR(X(), # X); }
|
||||||
|
|
||||||
|
#define NoArgOrFlagNoReturnFunction(X) \
|
||||||
|
static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
|
||||||
|
{ \
|
||||||
|
int flag = 0; \
|
||||||
|
PyCursesInitialised \
|
||||||
|
switch(PyTuple_Size(args)) { \
|
||||||
|
case 0: \
|
||||||
|
return PyCursesCheckERR(X(), # X); \
|
||||||
|
case 1: \
|
||||||
|
if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \
|
||||||
|
if (flag) return PyCursesCheckERR(X(), # X); \
|
||||||
|
else return PyCursesCheckERR(no ## X (), # X); \
|
||||||
|
default: \
|
||||||
|
PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \
|
||||||
|
return NULL; } }
|
||||||
|
|
||||||
|
#define NoArgReturnIntFunction(X) \
|
||||||
|
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||||
|
{ \
|
||||||
|
PyCursesInitialised \
|
||||||
|
return PyLong_FromLong((long) X()); }
|
||||||
|
|
||||||
|
|
||||||
|
#define NoArgReturnStringFunction(X) \
|
||||||
|
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||||
|
{ \
|
||||||
|
PyCursesInitialised \
|
||||||
|
return PyBytes_FromString(X()); }
|
||||||
|
|
||||||
|
#define NoArgTrueFalseFunction(X) \
|
||||||
|
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||||
|
{ \
|
||||||
|
PyCursesInitialised \
|
||||||
|
if (X () == FALSE) { \
|
||||||
|
Py_INCREF(Py_False); \
|
||||||
|
return Py_False; \
|
||||||
|
} \
|
||||||
|
Py_INCREF(Py_True); \
|
||||||
|
return Py_True; }
|
||||||
|
|
||||||
|
#define NoArgNoReturnVoidFunction(X) \
|
||||||
|
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||||
|
{ \
|
||||||
|
PyCursesInitialised \
|
||||||
|
X(); \
|
||||||
|
Py_INCREF(Py_None); \
|
||||||
|
return Py_None; }
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !defined(Py_CURSES_H) */
|
||||||
|
|
||||||
|
|
64
include/python3.5m/pyarena.h
Normal file
64
include/python3.5m/pyarena.h
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/* An arena-like memory interface for the compiler.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_PYARENA_H
|
||||||
|
#define Py_PYARENA_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct _arena PyArena;
|
||||||
|
|
||||||
|
/* PyArena_New() and PyArena_Free() create a new arena and free it,
|
||||||
|
respectively. Once an arena has been created, it can be used
|
||||||
|
to allocate memory via PyArena_Malloc(). Pointers to PyObject can
|
||||||
|
also be registered with the arena via PyArena_AddPyObject(), and the
|
||||||
|
arena will ensure that the PyObjects stay alive at least until
|
||||||
|
PyArena_Free() is called. When an arena is freed, all the memory it
|
||||||
|
allocated is freed, the arena releases internal references to registered
|
||||||
|
PyObject*, and none of its pointers are valid.
|
||||||
|
XXX (tim) What does "none of its pointers are valid" mean? Does it
|
||||||
|
XXX mean that pointers previously obtained via PyArena_Malloc() are
|
||||||
|
XXX no longer valid? (That's clearly true, but not sure that's what
|
||||||
|
XXX the text is trying to say.)
|
||||||
|
|
||||||
|
PyArena_New() returns an arena pointer. On error, it
|
||||||
|
returns a negative number and sets an exception.
|
||||||
|
XXX (tim): Not true. On error, PyArena_New() actually returns NULL,
|
||||||
|
XXX and looks like it may or may not set an exception (e.g., if the
|
||||||
|
XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on
|
||||||
|
XXX and an exception is set; OTOH, if the internal
|
||||||
|
XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
|
||||||
|
XXX an exception is not set in that case).
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyArena *) PyArena_New(void);
|
||||||
|
PyAPI_FUNC(void) PyArena_Free(PyArena *);
|
||||||
|
|
||||||
|
/* Mostly like malloc(), return the address of a block of memory spanning
|
||||||
|
* `size` bytes, or return NULL (without setting an exception) if enough
|
||||||
|
* new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with
|
||||||
|
* size=0 does not guarantee to return a unique pointer (the pointer
|
||||||
|
* returned may equal one or more other pointers obtained from
|
||||||
|
* PyArena_Malloc()).
|
||||||
|
* Note that pointers obtained via PyArena_Malloc() must never be passed to
|
||||||
|
* the system free() or realloc(), or to any of Python's similar memory-
|
||||||
|
* management functions. PyArena_Malloc()-obtained pointers remain valid
|
||||||
|
* until PyArena_Free(ar) is called, at which point all pointers obtained
|
||||||
|
* from the arena `ar` become invalid simultaneously.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size);
|
||||||
|
|
||||||
|
/* This routine isn't a proper arena allocation routine. It takes
|
||||||
|
* a PyObject* and records it so that it can be DECREFed when the
|
||||||
|
* arena is freed.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_PYARENA_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
252
include/python3.5m/pyatomic.h
Normal file
252
include/python3.5m/pyatomic.h
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
/* Issue #23644: <stdatomic.h> is incompatible with C++, see:
|
||||||
|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 */
|
||||||
|
#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
|
||||||
|
#ifndef Py_ATOMIC_H
|
||||||
|
#define Py_ATOMIC_H
|
||||||
|
|
||||||
|
#include "dynamic_annotations.h"
|
||||||
|
|
||||||
|
#include "pyconfig.h"
|
||||||
|
|
||||||
|
#if defined(HAVE_STD_ATOMIC)
|
||||||
|
#include <stdatomic.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is modeled after the atomics interface from C1x, according to
|
||||||
|
* the draft at
|
||||||
|
* http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1425.pdf.
|
||||||
|
* Operations and types are named the same except with a _Py_ prefix
|
||||||
|
* and have the same semantics.
|
||||||
|
*
|
||||||
|
* Beware, the implementations here are deep magic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(HAVE_STD_ATOMIC)
|
||||||
|
|
||||||
|
typedef enum _Py_memory_order {
|
||||||
|
_Py_memory_order_relaxed = memory_order_relaxed,
|
||||||
|
_Py_memory_order_acquire = memory_order_acquire,
|
||||||
|
_Py_memory_order_release = memory_order_release,
|
||||||
|
_Py_memory_order_acq_rel = memory_order_acq_rel,
|
||||||
|
_Py_memory_order_seq_cst = memory_order_seq_cst
|
||||||
|
} _Py_memory_order;
|
||||||
|
|
||||||
|
typedef struct _Py_atomic_address {
|
||||||
|
_Atomic void *_value;
|
||||||
|
} _Py_atomic_address;
|
||||||
|
|
||||||
|
typedef struct _Py_atomic_int {
|
||||||
|
atomic_int _value;
|
||||||
|
} _Py_atomic_int;
|
||||||
|
|
||||||
|
#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
|
||||||
|
atomic_signal_fence(ORDER)
|
||||||
|
|
||||||
|
#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
|
||||||
|
atomic_thread_fence(ORDER)
|
||||||
|
|
||||||
|
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
|
||||||
|
atomic_store_explicit(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER)
|
||||||
|
|
||||||
|
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
|
||||||
|
atomic_load_explicit(&(ATOMIC_VAL)->_value, ORDER)
|
||||||
|
|
||||||
|
/* Use builtin atomic operations in GCC >= 4.7 */
|
||||||
|
#elif defined(HAVE_BUILTIN_ATOMIC)
|
||||||
|
|
||||||
|
typedef enum _Py_memory_order {
|
||||||
|
_Py_memory_order_relaxed = __ATOMIC_RELAXED,
|
||||||
|
_Py_memory_order_acquire = __ATOMIC_ACQUIRE,
|
||||||
|
_Py_memory_order_release = __ATOMIC_RELEASE,
|
||||||
|
_Py_memory_order_acq_rel = __ATOMIC_ACQ_REL,
|
||||||
|
_Py_memory_order_seq_cst = __ATOMIC_SEQ_CST
|
||||||
|
} _Py_memory_order;
|
||||||
|
|
||||||
|
typedef struct _Py_atomic_address {
|
||||||
|
void *_value;
|
||||||
|
} _Py_atomic_address;
|
||||||
|
|
||||||
|
typedef struct _Py_atomic_int {
|
||||||
|
int _value;
|
||||||
|
} _Py_atomic_int;
|
||||||
|
|
||||||
|
#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) \
|
||||||
|
__atomic_signal_fence(ORDER)
|
||||||
|
|
||||||
|
#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) \
|
||||||
|
__atomic_thread_fence(ORDER)
|
||||||
|
|
||||||
|
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
|
||||||
|
(assert((ORDER) == __ATOMIC_RELAXED \
|
||||||
|
|| (ORDER) == __ATOMIC_SEQ_CST \
|
||||||
|
|| (ORDER) == __ATOMIC_RELEASE), \
|
||||||
|
__atomic_store_n(&(ATOMIC_VAL)->_value, NEW_VAL, ORDER))
|
||||||
|
|
||||||
|
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
|
||||||
|
(assert((ORDER) == __ATOMIC_RELAXED \
|
||||||
|
|| (ORDER) == __ATOMIC_SEQ_CST \
|
||||||
|
|| (ORDER) == __ATOMIC_ACQUIRE \
|
||||||
|
|| (ORDER) == __ATOMIC_CONSUME), \
|
||||||
|
__atomic_load_n(&(ATOMIC_VAL)->_value, ORDER))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef enum _Py_memory_order {
|
||||||
|
_Py_memory_order_relaxed,
|
||||||
|
_Py_memory_order_acquire,
|
||||||
|
_Py_memory_order_release,
|
||||||
|
_Py_memory_order_acq_rel,
|
||||||
|
_Py_memory_order_seq_cst
|
||||||
|
} _Py_memory_order;
|
||||||
|
|
||||||
|
typedef struct _Py_atomic_address {
|
||||||
|
void *_value;
|
||||||
|
} _Py_atomic_address;
|
||||||
|
|
||||||
|
typedef struct _Py_atomic_int {
|
||||||
|
int _value;
|
||||||
|
} _Py_atomic_int;
|
||||||
|
|
||||||
|
/* Only support GCC (for expression statements) and x86 (for simple
|
||||||
|
* atomic semantics) for now */
|
||||||
|
#if defined(__GNUC__) && (defined(__i386__) || defined(__amd64))
|
||||||
|
|
||||||
|
static __inline__ void
|
||||||
|
_Py_atomic_signal_fence(_Py_memory_order order)
|
||||||
|
{
|
||||||
|
if (order != _Py_memory_order_relaxed)
|
||||||
|
__asm__ volatile("":::"memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ void
|
||||||
|
_Py_atomic_thread_fence(_Py_memory_order order)
|
||||||
|
{
|
||||||
|
if (order != _Py_memory_order_relaxed)
|
||||||
|
__asm__ volatile("mfence":::"memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tell the race checker about this operation's effects. */
|
||||||
|
static __inline__ void
|
||||||
|
_Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
|
||||||
|
{
|
||||||
|
(void)address; /* shut up -Wunused-parameter */
|
||||||
|
switch(order) {
|
||||||
|
case _Py_memory_order_release:
|
||||||
|
case _Py_memory_order_acq_rel:
|
||||||
|
case _Py_memory_order_seq_cst:
|
||||||
|
_Py_ANNOTATE_HAPPENS_BEFORE(address);
|
||||||
|
break;
|
||||||
|
case _Py_memory_order_relaxed:
|
||||||
|
case _Py_memory_order_acquire:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch(order) {
|
||||||
|
case _Py_memory_order_acquire:
|
||||||
|
case _Py_memory_order_acq_rel:
|
||||||
|
case _Py_memory_order_seq_cst:
|
||||||
|
_Py_ANNOTATE_HAPPENS_AFTER(address);
|
||||||
|
break;
|
||||||
|
case _Py_memory_order_relaxed:
|
||||||
|
case _Py_memory_order_release:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
|
||||||
|
__extension__ ({ \
|
||||||
|
__typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \
|
||||||
|
__typeof__(atomic_val->_value) new_val = NEW_VAL;\
|
||||||
|
volatile __typeof__(new_val) *volatile_data = &atomic_val->_value; \
|
||||||
|
_Py_memory_order order = ORDER; \
|
||||||
|
_Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \
|
||||||
|
\
|
||||||
|
/* Perform the operation. */ \
|
||||||
|
_Py_ANNOTATE_IGNORE_WRITES_BEGIN(); \
|
||||||
|
switch(order) { \
|
||||||
|
case _Py_memory_order_release: \
|
||||||
|
_Py_atomic_signal_fence(_Py_memory_order_release); \
|
||||||
|
/* fallthrough */ \
|
||||||
|
case _Py_memory_order_relaxed: \
|
||||||
|
*volatile_data = new_val; \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
|
case _Py_memory_order_acquire: \
|
||||||
|
case _Py_memory_order_acq_rel: \
|
||||||
|
case _Py_memory_order_seq_cst: \
|
||||||
|
__asm__ volatile("xchg %0, %1" \
|
||||||
|
: "+r"(new_val) \
|
||||||
|
: "m"(atomic_val->_value) \
|
||||||
|
: "memory"); \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
_Py_ANNOTATE_IGNORE_WRITES_END(); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
|
||||||
|
__extension__ ({ \
|
||||||
|
__typeof__(ATOMIC_VAL) atomic_val = ATOMIC_VAL; \
|
||||||
|
__typeof__(atomic_val->_value) result; \
|
||||||
|
volatile __typeof__(result) *volatile_data = &atomic_val->_value; \
|
||||||
|
_Py_memory_order order = ORDER; \
|
||||||
|
_Py_ANNOTATE_MEMORY_ORDER(atomic_val, order); \
|
||||||
|
\
|
||||||
|
/* Perform the operation. */ \
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_BEGIN(); \
|
||||||
|
switch(order) { \
|
||||||
|
case _Py_memory_order_release: \
|
||||||
|
case _Py_memory_order_acq_rel: \
|
||||||
|
case _Py_memory_order_seq_cst: \
|
||||||
|
/* Loads on x86 are not releases by default, so need a */ \
|
||||||
|
/* thread fence. */ \
|
||||||
|
_Py_atomic_thread_fence(_Py_memory_order_release); \
|
||||||
|
break; \
|
||||||
|
default: \
|
||||||
|
/* No fence */ \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
result = *volatile_data; \
|
||||||
|
switch(order) { \
|
||||||
|
case _Py_memory_order_acquire: \
|
||||||
|
case _Py_memory_order_acq_rel: \
|
||||||
|
case _Py_memory_order_seq_cst: \
|
||||||
|
/* Loads on x86 are automatically acquire operations so */ \
|
||||||
|
/* can get by with just a compiler fence. */ \
|
||||||
|
_Py_atomic_signal_fence(_Py_memory_order_acquire); \
|
||||||
|
break; \
|
||||||
|
default: \
|
||||||
|
/* No fence */ \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
_Py_ANNOTATE_IGNORE_READS_END(); \
|
||||||
|
result; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#else /* !gcc x86 */
|
||||||
|
/* Fall back to other compilers and processors by assuming that simple
|
||||||
|
volatile accesses are atomic. This is false, so people should port
|
||||||
|
this. */
|
||||||
|
#define _Py_atomic_signal_fence(/*memory_order*/ ORDER) ((void)0)
|
||||||
|
#define _Py_atomic_thread_fence(/*memory_order*/ ORDER) ((void)0)
|
||||||
|
#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
|
||||||
|
((ATOMIC_VAL)->_value = NEW_VAL)
|
||||||
|
#define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \
|
||||||
|
((ATOMIC_VAL)->_value)
|
||||||
|
|
||||||
|
#endif /* !gcc x86 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Standardized shortcuts. */
|
||||||
|
#define _Py_atomic_store(ATOMIC_VAL, NEW_VAL) \
|
||||||
|
_Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_seq_cst)
|
||||||
|
#define _Py_atomic_load(ATOMIC_VAL) \
|
||||||
|
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_seq_cst)
|
||||||
|
|
||||||
|
/* Python-local extensions */
|
||||||
|
|
||||||
|
#define _Py_atomic_store_relaxed(ATOMIC_VAL, NEW_VAL) \
|
||||||
|
_Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_relaxed)
|
||||||
|
#define _Py_atomic_load_relaxed(ATOMIC_VAL) \
|
||||||
|
_Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed)
|
||||||
|
|
||||||
|
#endif /* Py_ATOMIC_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
59
include/python3.5m/pycapsule.h
Normal file
59
include/python3.5m/pycapsule.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
/* Capsule objects let you wrap a C "void *" pointer in a Python
|
||||||
|
object. They're a way of passing data through the Python interpreter
|
||||||
|
without creating your own custom type.
|
||||||
|
|
||||||
|
Capsules are used for communication between extension modules.
|
||||||
|
They provide a way for an extension module to export a C interface
|
||||||
|
to other extension modules, so that extension modules can use the
|
||||||
|
Python import mechanism to link to one another.
|
||||||
|
|
||||||
|
For more information, please see "c-api/capsule.html" in the
|
||||||
|
documentation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Py_CAPSULE_H
|
||||||
|
#define Py_CAPSULE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) PyCapsule_Type;
|
||||||
|
|
||||||
|
typedef void (*PyCapsule_Destructor)(PyObject *);
|
||||||
|
|
||||||
|
#define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type)
|
||||||
|
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyCapsule_New(
|
||||||
|
void *pointer,
|
||||||
|
const char *name,
|
||||||
|
PyCapsule_Destructor destructor);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name);
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule);
|
||||||
|
|
||||||
|
PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void *) PyCapsule_Import(
|
||||||
|
const char *name, /* UTF-8 encoded string */
|
||||||
|
int no_block);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_CAPSULE_H */
|
1530
include/python3.5m/pyconfig.h
Normal file
1530
include/python3.5m/pyconfig.h
Normal file
File diff suppressed because it is too large
Load diff
33
include/python3.5m/pyctype.h
Normal file
33
include/python3.5m/pyctype.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef PYCTYPE_H
|
||||||
|
#define PYCTYPE_H
|
||||||
|
|
||||||
|
#define PY_CTF_LOWER 0x01
|
||||||
|
#define PY_CTF_UPPER 0x02
|
||||||
|
#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
|
||||||
|
#define PY_CTF_DIGIT 0x04
|
||||||
|
#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
|
||||||
|
#define PY_CTF_SPACE 0x08
|
||||||
|
#define PY_CTF_XDIGIT 0x10
|
||||||
|
|
||||||
|
PyAPI_DATA(const unsigned int) _Py_ctype_table[256];
|
||||||
|
|
||||||
|
/* Unlike their C counterparts, the following macros are not meant to
|
||||||
|
* handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
|
||||||
|
* must be a signed/unsigned char. */
|
||||||
|
#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
|
||||||
|
#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
|
||||||
|
#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
|
||||||
|
#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
|
||||||
|
#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
|
||||||
|
#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
|
||||||
|
#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
|
||||||
|
|
||||||
|
PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256];
|
||||||
|
PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256];
|
||||||
|
|
||||||
|
#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
|
||||||
|
#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
|
||||||
|
|
||||||
|
#endif /* !PYCTYPE_H */
|
||||||
|
#endif /* !Py_LIMITED_API */
|
36
include/python3.5m/pydebug.h
Normal file
36
include/python3.5m/pydebug.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_PYDEBUG_H
|
||||||
|
#define Py_PYDEBUG_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These global variable are defined in pylifecycle.c */
|
||||||
|
/* XXX (ncoghlan): move these declarations to pylifecycle.h? */
|
||||||
|
PyAPI_DATA(int) Py_DebugFlag;
|
||||||
|
PyAPI_DATA(int) Py_VerboseFlag;
|
||||||
|
PyAPI_DATA(int) Py_QuietFlag;
|
||||||
|
PyAPI_DATA(int) Py_InteractiveFlag;
|
||||||
|
PyAPI_DATA(int) Py_InspectFlag;
|
||||||
|
PyAPI_DATA(int) Py_OptimizeFlag;
|
||||||
|
PyAPI_DATA(int) Py_NoSiteFlag;
|
||||||
|
PyAPI_DATA(int) Py_BytesWarningFlag;
|
||||||
|
PyAPI_DATA(int) Py_UseClassExceptionsFlag;
|
||||||
|
PyAPI_DATA(int) Py_FrozenFlag;
|
||||||
|
PyAPI_DATA(int) Py_IgnoreEnvironmentFlag;
|
||||||
|
PyAPI_DATA(int) Py_DontWriteBytecodeFlag;
|
||||||
|
PyAPI_DATA(int) Py_NoUserSiteDirectory;
|
||||||
|
PyAPI_DATA(int) Py_UnbufferedStdioFlag;
|
||||||
|
PyAPI_DATA(int) Py_HashRandomizationFlag;
|
||||||
|
PyAPI_DATA(int) Py_IsolatedFlag;
|
||||||
|
|
||||||
|
/* this is a wrapper around getenv() that pays attention to
|
||||||
|
Py_IgnoreEnvironmentFlag. It should be used for getting variables like
|
||||||
|
PYTHONPATH and PYTHONHOME from the environment */
|
||||||
|
#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PYDEBUG_H */
|
||||||
|
#endif /* Py_LIMITED_API */
|
475
include/python3.5m/pyerrors.h
Normal file
475
include/python3.5m/pyerrors.h
Normal file
|
@ -0,0 +1,475 @@
|
||||||
|
#ifndef Py_ERRORS_H
|
||||||
|
#define Py_ERRORS_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Error objects */
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* PyException_HEAD defines the initial segment of every exception class. */
|
||||||
|
#define PyException_HEAD PyObject_HEAD PyObject *dict;\
|
||||||
|
PyObject *args; PyObject *traceback;\
|
||||||
|
PyObject *context; PyObject *cause;\
|
||||||
|
char suppress_context;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
} PyBaseExceptionObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
PyObject *msg;
|
||||||
|
PyObject *filename;
|
||||||
|
PyObject *lineno;
|
||||||
|
PyObject *offset;
|
||||||
|
PyObject *text;
|
||||||
|
PyObject *print_file_and_line;
|
||||||
|
} PySyntaxErrorObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
PyObject *msg;
|
||||||
|
PyObject *name;
|
||||||
|
PyObject *path;
|
||||||
|
} PyImportErrorObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
PyObject *encoding;
|
||||||
|
PyObject *object;
|
||||||
|
Py_ssize_t start;
|
||||||
|
Py_ssize_t end;
|
||||||
|
PyObject *reason;
|
||||||
|
} PyUnicodeErrorObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
PyObject *code;
|
||||||
|
} PySystemExitObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
PyObject *myerrno;
|
||||||
|
PyObject *strerror;
|
||||||
|
PyObject *filename;
|
||||||
|
PyObject *filename2;
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
PyObject *winerror;
|
||||||
|
#endif
|
||||||
|
Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */
|
||||||
|
} PyOSErrorObject;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyException_HEAD
|
||||||
|
PyObject *value;
|
||||||
|
} PyStopIterationObject;
|
||||||
|
|
||||||
|
/* Compatibility typedefs */
|
||||||
|
typedef PyOSErrorObject PyEnvironmentErrorObject;
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
typedef PyOSErrorObject PyWindowsErrorObject;
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_LIMITED_API */
|
||||||
|
|
||||||
|
/* Error handling definitions */
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(void) PyErr_SetString(
|
||||||
|
PyObject *exception,
|
||||||
|
const char *string /* decoded from utf-8 */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
|
||||||
|
PyAPI_FUNC(void) PyErr_Clear(void);
|
||||||
|
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
|
||||||
|
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);
|
||||||
|
PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
|
||||||
|
|
||||||
|
#if defined(__clang__) || \
|
||||||
|
(defined(__GNUC_MAJOR__) && \
|
||||||
|
((__GNUC_MAJOR__ >= 3) || \
|
||||||
|
(__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5)))
|
||||||
|
#define _Py_NO_RETURN __attribute__((__noreturn__))
|
||||||
|
#else
|
||||||
|
#define _Py_NO_RETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Defined in Python/pylifecycle.c */
|
||||||
|
PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
|
||||||
|
|
||||||
|
#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
|
||||||
|
#define _PyErr_OCCURRED() PyErr_Occurred()
|
||||||
|
#else
|
||||||
|
#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Error testing and normalization */
|
||||||
|
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
|
||||||
|
|
||||||
|
/* Traceback manipulation (PEP 3134) */
|
||||||
|
PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *);
|
||||||
|
|
||||||
|
/* Cause manipulation (PEP 3134) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
/* Context manipulation (PEP 3134) */
|
||||||
|
PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);
|
||||||
|
PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
|
#define PyExceptionClass_Check(x) \
|
||||||
|
(PyType_Check((x)) && \
|
||||||
|
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))
|
||||||
|
|
||||||
|
#define PyExceptionInstance_Check(x) \
|
||||||
|
PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)
|
||||||
|
|
||||||
|
#define PyExceptionClass_Name(x) \
|
||||||
|
((char *)(((PyTypeObject*)(x))->tp_name))
|
||||||
|
|
||||||
|
#define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
|
||||||
|
|
||||||
|
|
||||||
|
/* Predefined exceptions */
|
||||||
|
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_BaseException;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_Exception;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_StopIteration;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_GeneratorExit;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ArithmeticError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_LookupError;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_AssertionError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_AttributeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_BufferError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_EOFError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_FloatingPointError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_OSError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ImportError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_IndexError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_KeyError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_MemoryError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_NameError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_OverflowError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_RuntimeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_RecursionError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_NotImplementedError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_SyntaxError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_IndentationError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_TabError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ReferenceError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_SystemError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_SystemExit;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_TypeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UnicodeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ValueError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;
|
||||||
|
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_BlockingIOError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_BrokenPipeError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ChildProcessError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ConnectionError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ConnectionResetError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_FileExistsError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_FileNotFoundError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_InterruptedError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_IsADirectoryError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_NotADirectoryError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_PermissionError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ProcessLookupError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_TimeoutError;
|
||||||
|
|
||||||
|
|
||||||
|
/* Compatibility aliases */
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_EnvironmentError;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_IOError;
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_WindowsError;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
|
||||||
|
|
||||||
|
/* Predefined warning categories */
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_Warning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UserWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_FutureWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ImportWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_BytesWarning;
|
||||||
|
PyAPI_DATA(PyObject *) PyExc_ResourceWarning;
|
||||||
|
|
||||||
|
|
||||||
|
/* Convenience functions */
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyErr_BadArgument(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
|
||||||
|
PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects(
|
||||||
|
PyObject *, PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
|
||||||
|
PyObject *exc,
|
||||||
|
const char *filename /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
#if defined(MS_WINDOWS) && !defined(Py_LIMITED_API)
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
|
||||||
|
PyObject *, const Py_UNICODE *);
|
||||||
|
#endif /* MS_WINDOWS */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_Format(
|
||||||
|
PyObject *exception,
|
||||||
|
const char *format, /* ASCII-encoded string */
|
||||||
|
...
|
||||||
|
);
|
||||||
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_FormatV(
|
||||||
|
PyObject *exception,
|
||||||
|
const char *format,
|
||||||
|
va_list vargs);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
|
||||||
|
int ierr,
|
||||||
|
const char *filename /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* XXX redeclare to use WSTRING */
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
|
||||||
|
int, const Py_UNICODE *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
|
||||||
|
PyObject *,int, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects(
|
||||||
|
PyObject *,int, PyObject *, PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
|
||||||
|
PyObject *exc,
|
||||||
|
int ierr,
|
||||||
|
const char *filename /* decoded from the filesystem encoding */
|
||||||
|
);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
|
||||||
|
PyObject *,int, const Py_UNICODE *);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
|
||||||
|
#endif /* MS_WINDOWS */
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *,
|
||||||
|
PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *,
|
||||||
|
PyObject *);
|
||||||
|
|
||||||
|
/* Export the old function so that the existing API remains available: */
|
||||||
|
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
|
||||||
|
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
|
||||||
|
/* Mask the old API with a call to the new API for code compiled under
|
||||||
|
Python 2.0: */
|
||||||
|
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
|
||||||
|
|
||||||
|
/* Function to create a new exception */
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_NewException(
|
||||||
|
const char *name, PyObject *base, PyObject *dict);
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
|
||||||
|
const char *name, const char *doc, PyObject *base, PyObject *dict);
|
||||||
|
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
|
||||||
|
|
||||||
|
/* In exceptions.c */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* Helper that attempts to replace the current exception with one of the
|
||||||
|
* same type but with a prefix added to the exception text. The resulting
|
||||||
|
* exception description looks like:
|
||||||
|
*
|
||||||
|
* prefix (exc_type: original_exc_str)
|
||||||
|
*
|
||||||
|
* Only some exceptions can be safely replaced. If the function determines
|
||||||
|
* it isn't safe to perform the replacement, it will leave the original
|
||||||
|
* unmodified exception in place.
|
||||||
|
*
|
||||||
|
* Returns a borrowed reference to the new exception (if any), NULL if the
|
||||||
|
* existing exception was left in place.
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
|
||||||
|
const char *prefix_format, /* ASCII-encoded string */
|
||||||
|
...
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* In sigcheck.c or signalmodule.c */
|
||||||
|
PyAPI_FUNC(int) PyErr_CheckSignals(void);
|
||||||
|
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
|
||||||
|
|
||||||
|
/* In signalmodule.c */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
int PySignal_SetWakeupFd(int fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Support for adding program text to SyntaxErrors */
|
||||||
|
PyAPI_FUNC(void) PyErr_SyntaxLocation(
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
int lineno);
|
||||||
|
PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
int lineno,
|
||||||
|
int col_offset);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
|
||||||
|
PyObject *filename,
|
||||||
|
int lineno,
|
||||||
|
int col_offset);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_ProgramText(
|
||||||
|
const char *filename, /* decoded from the filesystem encoding */
|
||||||
|
int lineno);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
|
||||||
|
PyObject *filename,
|
||||||
|
int lineno);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following functions are used to create and modify unicode
|
||||||
|
exceptions from C */
|
||||||
|
|
||||||
|
/* create a UnicodeDecodeError object */
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
|
||||||
|
const char *encoding, /* UTF-8 encoded string */
|
||||||
|
const char *object,
|
||||||
|
Py_ssize_t length,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* create a UnicodeEncodeError object */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
|
||||||
|
const char *encoding, /* UTF-8 encoded string */
|
||||||
|
const Py_UNICODE *object,
|
||||||
|
Py_ssize_t length,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* create a UnicodeTranslateError object */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
|
||||||
|
const Py_UNICODE *object,
|
||||||
|
Py_ssize_t length,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
|
||||||
|
PyObject *object,
|
||||||
|
Py_ssize_t start,
|
||||||
|
Py_ssize_t end,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* get the encoding attribute */
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
|
||||||
|
|
||||||
|
/* get the object attribute */
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
|
||||||
|
|
||||||
|
/* get the value of the start attribute (the int * may not be NULL)
|
||||||
|
return 0 on success, -1 on failure */
|
||||||
|
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
|
||||||
|
|
||||||
|
/* assign a new value to the start attribute
|
||||||
|
return 0 on success, -1 on failure */
|
||||||
|
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
|
||||||
|
|
||||||
|
/* get the value of the end attribute (the int *may not be NULL)
|
||||||
|
return 0 on success, -1 on failure */
|
||||||
|
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
|
||||||
|
|
||||||
|
/* assign a new value to the end attribute
|
||||||
|
return 0 on success, -1 on failure */
|
||||||
|
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
|
||||||
|
|
||||||
|
/* get the value of the reason attribute */
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
|
||||||
|
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
|
||||||
|
|
||||||
|
/* assign a new value to the reason attribute
|
||||||
|
return 0 on success, -1 on failure */
|
||||||
|
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
|
||||||
|
PyObject *exc,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
|
||||||
|
PyObject *exc,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
|
||||||
|
PyObject *exc,
|
||||||
|
const char *reason /* UTF-8 encoded string */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* These APIs aren't really part of the error implementation, but
|
||||||
|
often needed to format error messages; the native C lib APIs are
|
||||||
|
not available on all platforms, which is why we provide emulations
|
||||||
|
for those platforms in Python/mysnprintf.c,
|
||||||
|
WARNING: The return value of snprintf varies across platforms; do
|
||||||
|
not rely on any particular behavior; eventually the C99 defn may
|
||||||
|
be reliable.
|
||||||
|
*/
|
||||||
|
#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
|
||||||
|
# define HAVE_SNPRINTF
|
||||||
|
# define snprintf _snprintf
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
|
||||||
|
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
|
||||||
|
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_ERRORS_H */
|
53
include/python3.5m/pyexpat.h
Normal file
53
include/python3.5m/pyexpat.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/* Stuff to export relevant 'expat' entry points from pyexpat to other
|
||||||
|
* parser modules, such as cElementTree. */
|
||||||
|
|
||||||
|
/* note: you must import expat.h before importing this module! */
|
||||||
|
|
||||||
|
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
|
||||||
|
#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
|
||||||
|
|
||||||
|
struct PyExpat_CAPI
|
||||||
|
{
|
||||||
|
char* magic; /* set to PyExpat_CAPI_MAGIC */
|
||||||
|
int size; /* set to sizeof(struct PyExpat_CAPI) */
|
||||||
|
int MAJOR_VERSION;
|
||||||
|
int MINOR_VERSION;
|
||||||
|
int MICRO_VERSION;
|
||||||
|
/* pointers to selected expat functions. add new functions at
|
||||||
|
the end, if needed */
|
||||||
|
const XML_LChar * (*ErrorString)(enum XML_Error code);
|
||||||
|
enum XML_Error (*GetErrorCode)(XML_Parser parser);
|
||||||
|
XML_Size (*GetErrorColumnNumber)(XML_Parser parser);
|
||||||
|
XML_Size (*GetErrorLineNumber)(XML_Parser parser);
|
||||||
|
enum XML_Status (*Parse)(
|
||||||
|
XML_Parser parser, const char *s, int len, int isFinal);
|
||||||
|
XML_Parser (*ParserCreate_MM)(
|
||||||
|
const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite,
|
||||||
|
const XML_Char *namespaceSeparator);
|
||||||
|
void (*ParserFree)(XML_Parser parser);
|
||||||
|
void (*SetCharacterDataHandler)(
|
||||||
|
XML_Parser parser, XML_CharacterDataHandler handler);
|
||||||
|
void (*SetCommentHandler)(
|
||||||
|
XML_Parser parser, XML_CommentHandler handler);
|
||||||
|
void (*SetDefaultHandlerExpand)(
|
||||||
|
XML_Parser parser, XML_DefaultHandler handler);
|
||||||
|
void (*SetElementHandler)(
|
||||||
|
XML_Parser parser, XML_StartElementHandler start,
|
||||||
|
XML_EndElementHandler end);
|
||||||
|
void (*SetNamespaceDeclHandler)(
|
||||||
|
XML_Parser parser, XML_StartNamespaceDeclHandler start,
|
||||||
|
XML_EndNamespaceDeclHandler end);
|
||||||
|
void (*SetProcessingInstructionHandler)(
|
||||||
|
XML_Parser parser, XML_ProcessingInstructionHandler handler);
|
||||||
|
void (*SetUnknownEncodingHandler)(
|
||||||
|
XML_Parser parser, XML_UnknownEncodingHandler handler,
|
||||||
|
void *encodingHandlerData);
|
||||||
|
void (*SetUserData)(XML_Parser parser, void *userData);
|
||||||
|
void (*SetStartDoctypeDeclHandler)(XML_Parser parser,
|
||||||
|
XML_StartDoctypeDeclHandler start);
|
||||||
|
enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
|
||||||
|
int (*DefaultUnknownEncodingHandler)(
|
||||||
|
void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
|
||||||
|
/* always add new stuff to the end! */
|
||||||
|
};
|
||||||
|
|
176
include/python3.5m/pyfpe.h
Normal file
176
include/python3.5m/pyfpe.h
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
#ifndef Py_PYFPE_H
|
||||||
|
#define Py_PYFPE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
/ Copyright (c) 1996. \
|
||||||
|
| The Regents of the University of California. |
|
||||||
|
| All rights reserved. |
|
||||||
|
| |
|
||||||
|
| Permission to use, copy, modify, and distribute this software for |
|
||||||
|
| any purpose without fee is hereby granted, provided that this en- |
|
||||||
|
| tire notice is included in all copies of any software which is or |
|
||||||
|
| includes a copy or modification of this software and in all |
|
||||||
|
| copies of the supporting documentation for such software. |
|
||||||
|
| |
|
||||||
|
| This work was produced at the University of California, Lawrence |
|
||||||
|
| Livermore National Laboratory under contract no. W-7405-ENG-48 |
|
||||||
|
| between the U.S. Department of Energy and The Regents of the |
|
||||||
|
| University of California for the operation of UC LLNL. |
|
||||||
|
| |
|
||||||
|
| DISCLAIMER |
|
||||||
|
| |
|
||||||
|
| This software was prepared as an account of work sponsored by an |
|
||||||
|
| agency of the United States Government. Neither the United States |
|
||||||
|
| Government nor the University of California nor any of their em- |
|
||||||
|
| ployees, makes any warranty, express or implied, or assumes any |
|
||||||
|
| liability or responsibility for the accuracy, completeness, or |
|
||||||
|
| usefulness of any information, apparatus, product, or process |
|
||||||
|
| disclosed, or represents that its use would not infringe |
|
||||||
|
| privately-owned rights. Reference herein to any specific commer- |
|
||||||
|
| cial products, process, or service by trade name, trademark, |
|
||||||
|
| manufacturer, or otherwise, does not necessarily constitute or |
|
||||||
|
| imply its endorsement, recommendation, or favoring by the United |
|
||||||
|
| States Government or the University of California. The views and |
|
||||||
|
| opinions of authors expressed herein do not necessarily state or |
|
||||||
|
| reflect those of the United States Government or the University |
|
||||||
|
| of California, and shall not be used for advertising or product |
|
||||||
|
\ endorsement purposes. /
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define macros for handling SIGFPE.
|
||||||
|
* Lee Busby, LLNL, November, 1996
|
||||||
|
* busby1@llnl.gov
|
||||||
|
*
|
||||||
|
*********************************************
|
||||||
|
* Overview of the system for handling SIGFPE:
|
||||||
|
*
|
||||||
|
* This file (Include/pyfpe.h) defines a couple of "wrapper" macros for
|
||||||
|
* insertion into your Python C code of choice. Their proper use is
|
||||||
|
* discussed below. The file Python/pyfpe.c defines a pair of global
|
||||||
|
* variables PyFPE_jbuf and PyFPE_counter which are used by the signal
|
||||||
|
* handler for SIGFPE to decide if a particular exception was protected
|
||||||
|
* by the macros. The signal handler itself, and code for enabling the
|
||||||
|
* generation of SIGFPE in the first place, is in a (new) Python module
|
||||||
|
* named fpectl. This module is standard in every respect. It can be loaded
|
||||||
|
* either statically or dynamically as you choose, and like any other
|
||||||
|
* Python module, has no effect until you import it.
|
||||||
|
*
|
||||||
|
* In the general case, there are three steps toward handling SIGFPE in any
|
||||||
|
* Python code:
|
||||||
|
*
|
||||||
|
* 1) Add the *_PROTECT macros to your C code as required to protect
|
||||||
|
* dangerous floating point sections.
|
||||||
|
*
|
||||||
|
* 2) Turn on the inclusion of the code by adding the ``--with-fpectl''
|
||||||
|
* flag at the time you run configure. If the fpectl or other modules
|
||||||
|
* which use the *_PROTECT macros are to be dynamically loaded, be
|
||||||
|
* sure they are compiled with WANT_SIGFPE_HANDLER defined.
|
||||||
|
*
|
||||||
|
* 3) When python is built and running, import fpectl, and execute
|
||||||
|
* fpectl.turnon_sigfpe(). This sets up the signal handler and enables
|
||||||
|
* generation of SIGFPE whenever an exception occurs. From this point
|
||||||
|
* on, any properly trapped SIGFPE should result in the Python
|
||||||
|
* FloatingPointError exception.
|
||||||
|
*
|
||||||
|
* Step 1 has been done already for the Python kernel code, and should be
|
||||||
|
* done soon for the NumPy array package. Step 2 is usually done once at
|
||||||
|
* python install time. Python's behavior with respect to SIGFPE is not
|
||||||
|
* changed unless you also do step 3. Thus you can control this new
|
||||||
|
* facility at compile time, or run time, or both.
|
||||||
|
*
|
||||||
|
********************************
|
||||||
|
* Using the macros in your code:
|
||||||
|
*
|
||||||
|
* static PyObject *foobar(PyObject *self,PyObject *args)
|
||||||
|
* {
|
||||||
|
* ....
|
||||||
|
* PyFPE_START_PROTECT("Error in foobar", return 0)
|
||||||
|
* result = dangerous_op(somearg1, somearg2, ...);
|
||||||
|
* PyFPE_END_PROTECT(result)
|
||||||
|
* ....
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* If a floating point error occurs in dangerous_op, foobar returns 0 (NULL),
|
||||||
|
* after setting the associated value of the FloatingPointError exception to
|
||||||
|
* "Error in foobar". ``Dangerous_op'' can be a single operation, or a block
|
||||||
|
* of code, function calls, or any combination, so long as no alternate
|
||||||
|
* return is possible before the PyFPE_END_PROTECT macro is reached.
|
||||||
|
*
|
||||||
|
* The macros can only be used in a function context where an error return
|
||||||
|
* can be recognized as signaling a Python exception. (Generally, most
|
||||||
|
* functions that return a PyObject * will qualify.)
|
||||||
|
*
|
||||||
|
* Guido's original design suggestion for PyFPE_START_PROTECT and
|
||||||
|
* PyFPE_END_PROTECT had them open and close a local block, with a locally
|
||||||
|
* defined jmp_buf and jmp_buf pointer. This would allow recursive nesting
|
||||||
|
* of the macros. The Ansi C standard makes it clear that such local
|
||||||
|
* variables need to be declared with the "volatile" type qualifier to keep
|
||||||
|
* setjmp from corrupting their values. Some current implementations seem
|
||||||
|
* to be more restrictive. For example, the HPUX man page for setjmp says
|
||||||
|
*
|
||||||
|
* Upon the return from a setjmp() call caused by a longjmp(), the
|
||||||
|
* values of any non-static local variables belonging to the routine
|
||||||
|
* from which setjmp() was called are undefined. Code which depends on
|
||||||
|
* such values is not guaranteed to be portable.
|
||||||
|
*
|
||||||
|
* I therefore decided on a more limited form of nesting, using a counter
|
||||||
|
* variable (PyFPE_counter) to keep track of any recursion. If an exception
|
||||||
|
* occurs in an ``inner'' pair of macros, the return will apparently
|
||||||
|
* come from the outermost level.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef WANT_SIGFPE_HANDLER
|
||||||
|
#include <signal.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <math.h>
|
||||||
|
extern jmp_buf PyFPE_jbuf;
|
||||||
|
extern int PyFPE_counter;
|
||||||
|
extern double PyFPE_dummy(void *);
|
||||||
|
|
||||||
|
#define PyFPE_START_PROTECT(err_string, leave_stmt) \
|
||||||
|
if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \
|
||||||
|
PyErr_SetString(PyExc_FloatingPointError, err_string); \
|
||||||
|
PyFPE_counter = 0; \
|
||||||
|
leave_stmt; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This (following) is a heck of a way to decrement a counter. However,
|
||||||
|
* unless the macro argument is provided, code optimizers will sometimes move
|
||||||
|
* this statement so that it gets executed *before* the unsafe expression
|
||||||
|
* which we're trying to protect. That pretty well messes things up,
|
||||||
|
* of course.
|
||||||
|
*
|
||||||
|
* If the expression(s) you're trying to protect don't happen to return a
|
||||||
|
* value, you will need to manufacture a dummy result just to preserve the
|
||||||
|
* correct ordering of statements. Note that the macro passes the address
|
||||||
|
* of its argument (so you need to give it something which is addressable).
|
||||||
|
* If your expression returns multiple results, pass the last such result
|
||||||
|
* to PyFPE_END_PROTECT.
|
||||||
|
*
|
||||||
|
* Note that PyFPE_dummy returns a double, which is cast to int.
|
||||||
|
* This seeming insanity is to tickle the Floating Point Unit (FPU).
|
||||||
|
* If an exception has occurred in a preceding floating point operation,
|
||||||
|
* some architectures (notably Intel 80x86) will not deliver the interrupt
|
||||||
|
* until the *next* floating point operation. This is painful if you've
|
||||||
|
* already decremented PyFPE_counter.
|
||||||
|
*/
|
||||||
|
#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v));
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define PyFPE_START_PROTECT(err_string, leave_stmt)
|
||||||
|
#define PyFPE_END_PROTECT(v)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PYFPE_H */
|
21
include/python3.5m/pygetopt.h
Normal file
21
include/python3.5m/pygetopt.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
#ifndef Py_PYGETOPT_H
|
||||||
|
#define Py_PYGETOPT_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_DATA(int) _PyOS_opterr;
|
||||||
|
PyAPI_DATA(int) _PyOS_optind;
|
||||||
|
PyAPI_DATA(wchar_t *) _PyOS_optarg;
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyOS_ResetGetOpt(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PYGETOPT_H */
|
149
include/python3.5m/pyhash.h
Normal file
149
include/python3.5m/pyhash.h
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
#ifndef Py_HASH_H
|
||||||
|
|
||||||
|
#define Py_HASH_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Helpers for hash functions */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(Py_hash_t) _Py_HashDouble(double);
|
||||||
|
PyAPI_FUNC(Py_hash_t) _Py_HashPointer(void*);
|
||||||
|
PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Prime multiplier used in string and various other hashes. */
|
||||||
|
#define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */
|
||||||
|
|
||||||
|
/* Parameters used for the numeric hash implementation. See notes for
|
||||||
|
_Py_HashDouble in Objects/object.c. Numeric hashes are based on
|
||||||
|
reduction modulo the prime 2**_PyHASH_BITS - 1. */
|
||||||
|
|
||||||
|
#if SIZEOF_VOID_P >= 8
|
||||||
|
# define _PyHASH_BITS 61
|
||||||
|
#else
|
||||||
|
# define _PyHASH_BITS 31
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
|
||||||
|
#define _PyHASH_INF 314159
|
||||||
|
#define _PyHASH_NAN 0
|
||||||
|
#define _PyHASH_IMAG _PyHASH_MULTIPLIER
|
||||||
|
|
||||||
|
|
||||||
|
/* hash secret
|
||||||
|
*
|
||||||
|
* memory layout on 64 bit systems
|
||||||
|
* cccccccc cccccccc cccccccc uc -- unsigned char[24]
|
||||||
|
* pppppppp ssssssss ........ fnv -- two Py_hash_t
|
||||||
|
* k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T
|
||||||
|
* ........ ........ ssssssss djbx33a -- 16 bytes padding + one Py_hash_t
|
||||||
|
* ........ ........ eeeeeeee pyexpat XML hash salt
|
||||||
|
*
|
||||||
|
* memory layout on 32 bit systems
|
||||||
|
* cccccccc cccccccc cccccccc uc
|
||||||
|
* ppppssss ........ ........ fnv -- two Py_hash_t
|
||||||
|
* k0k0k0k0 k1k1k1k1 ........ siphash -- two PY_UINT64_T (*)
|
||||||
|
* ........ ........ ssss.... djbx33a -- 16 bytes padding + one Py_hash_t
|
||||||
|
* ........ ........ eeee.... pyexpat XML hash salt
|
||||||
|
*
|
||||||
|
* (*) The siphash member may not be available on 32 bit platforms without
|
||||||
|
* an unsigned int64 data type.
|
||||||
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef union {
|
||||||
|
/* ensure 24 bytes */
|
||||||
|
unsigned char uc[24];
|
||||||
|
/* two Py_hash_t for FNV */
|
||||||
|
struct {
|
||||||
|
Py_hash_t prefix;
|
||||||
|
Py_hash_t suffix;
|
||||||
|
} fnv;
|
||||||
|
#ifdef PY_UINT64_T
|
||||||
|
/* two uint64 for SipHash24 */
|
||||||
|
struct {
|
||||||
|
PY_UINT64_T k0;
|
||||||
|
PY_UINT64_T k1;
|
||||||
|
} siphash;
|
||||||
|
#endif
|
||||||
|
/* a different (!) Py_hash_t for small string optimization */
|
||||||
|
struct {
|
||||||
|
unsigned char padding[16];
|
||||||
|
Py_hash_t suffix;
|
||||||
|
} djbx33a;
|
||||||
|
struct {
|
||||||
|
unsigned char padding[16];
|
||||||
|
Py_hash_t hashsalt;
|
||||||
|
} expat;
|
||||||
|
} _Py_HashSecret_t;
|
||||||
|
PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Py_DEBUG
|
||||||
|
PyAPI_DATA(int) _Py_HashSecret_Initialized;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* hash function definition */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
typedef struct {
|
||||||
|
Py_hash_t (*const hash)(const void *, Py_ssize_t);
|
||||||
|
const char *name;
|
||||||
|
const int hash_bits;
|
||||||
|
const int seed_bits;
|
||||||
|
} PyHash_FuncDef;
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* cutoff for small string DJBX33A optimization in range [1, cutoff).
|
||||||
|
*
|
||||||
|
* About 50% of the strings in a typical Python application are smaller than
|
||||||
|
* 6 to 7 chars. However DJBX33A is vulnerable to hash collision attacks.
|
||||||
|
* NEVER use DJBX33A for long strings!
|
||||||
|
*
|
||||||
|
* A Py_HASH_CUTOFF of 0 disables small string optimization. 32 bit platforms
|
||||||
|
* should use a smaller cutoff because it is easier to create colliding
|
||||||
|
* strings. A cutoff of 7 on 64bit platforms and 5 on 32bit platforms should
|
||||||
|
* provide a decent safety margin.
|
||||||
|
*/
|
||||||
|
#ifndef Py_HASH_CUTOFF
|
||||||
|
# define Py_HASH_CUTOFF 0
|
||||||
|
#elif (Py_HASH_CUTOFF > 7 || Py_HASH_CUTOFF < 0)
|
||||||
|
# error Py_HASH_CUTOFF must in range 0...7.
|
||||||
|
#endif /* Py_HASH_CUTOFF */
|
||||||
|
|
||||||
|
|
||||||
|
/* hash algorithm selection
|
||||||
|
*
|
||||||
|
* The values for Py_HASH_SIPHASH24 and Py_HASH_FNV are hard-coded in the
|
||||||
|
* configure script.
|
||||||
|
*
|
||||||
|
* - FNV is available on all platforms and architectures.
|
||||||
|
* - SIPHASH24 only works on plaforms that provide PY_UINT64_T and doesn't
|
||||||
|
* require aligned memory for integers.
|
||||||
|
* - With EXTERNAL embedders can provide an alternative implementation with::
|
||||||
|
*
|
||||||
|
* PyHash_FuncDef PyHash_Func = {...};
|
||||||
|
*
|
||||||
|
* XXX: Figure out __declspec() for extern PyHash_FuncDef.
|
||||||
|
*/
|
||||||
|
#define Py_HASH_EXTERNAL 0
|
||||||
|
#define Py_HASH_SIPHASH24 1
|
||||||
|
#define Py_HASH_FNV 2
|
||||||
|
|
||||||
|
#ifndef Py_HASH_ALGORITHM
|
||||||
|
# if (defined(PY_UINT64_T) && defined(PY_UINT32_T) \
|
||||||
|
&& !defined(HAVE_ALIGNED_REQUIRED))
|
||||||
|
# define Py_HASH_ALGORITHM Py_HASH_SIPHASH24
|
||||||
|
# else
|
||||||
|
# define Py_HASH_ALGORITHM Py_HASH_FNV
|
||||||
|
# endif /* uint64_t && uint32_t && aligned */
|
||||||
|
#endif /* Py_HASH_ALGORITHM */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !Py_HASH_H */
|
124
include/python3.5m/pylifecycle.h
Normal file
124
include/python3.5m/pylifecycle.h
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
|
||||||
|
/* Interfaces to configure, query, create & destroy the Python runtime */
|
||||||
|
|
||||||
|
#ifndef Py_PYLIFECYCLE_H
|
||||||
|
#define Py_PYLIFECYCLE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
/* Only used by applications that embed the interpreter and need to
|
||||||
|
* override the standard encoding determination mechanism
|
||||||
|
*/
|
||||||
|
PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
|
||||||
|
const char *errors);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) Py_Initialize(void);
|
||||||
|
PyAPI_FUNC(void) Py_InitializeEx(int);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int);
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(void) Py_Finalize(void);
|
||||||
|
PyAPI_FUNC(int) Py_IsInitialized(void);
|
||||||
|
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
|
||||||
|
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
|
||||||
|
|
||||||
|
|
||||||
|
/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
|
||||||
|
* exit functions.
|
||||||
|
*/
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
|
||||||
|
#endif
|
||||||
|
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) Py_Exit(int);
|
||||||
|
|
||||||
|
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _Py_RestoreSignals(void);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Bootstrap __main__ (defined in Modules/main.c) */
|
||||||
|
PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
|
||||||
|
|
||||||
|
/* In getpath.c */
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
|
||||||
|
PyAPI_FUNC(wchar_t *) Py_GetPath(void);
|
||||||
|
PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
int _Py_CheckPython3();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* In their own files */
|
||||||
|
PyAPI_FUNC(const char *) Py_GetVersion(void);
|
||||||
|
PyAPI_FUNC(const char *) Py_GetPlatform(void);
|
||||||
|
PyAPI_FUNC(const char *) Py_GetCopyright(void);
|
||||||
|
PyAPI_FUNC(const char *) Py_GetCompiler(void);
|
||||||
|
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(const char *) _Py_hgidentifier(void);
|
||||||
|
PyAPI_FUNC(const char *) _Py_hgversion(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Internal -- various one-time initializations */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
|
||||||
|
PyAPI_FUNC(PyObject *) _PySys_Init(void);
|
||||||
|
PyAPI_FUNC(void) _PyImport_Init(void);
|
||||||
|
PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
|
||||||
|
PyAPI_FUNC(void) _PyImportHooks_Init(void);
|
||||||
|
PyAPI_FUNC(int) _PyFrame_Init(void);
|
||||||
|
PyAPI_FUNC(int) _PyFloat_Init(void);
|
||||||
|
PyAPI_FUNC(int) PyByteArray_Init(void);
|
||||||
|
PyAPI_FUNC(void) _PyRandom_Init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Various internal finalizers */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
PyAPI_FUNC(void) _PyExc_Fini(void);
|
||||||
|
PyAPI_FUNC(void) _PyImport_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyMethod_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyFrame_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyCFunction_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyDict_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyTuple_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyList_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PySet_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyBytes_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyByteArray_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyFloat_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
|
||||||
|
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
|
||||||
|
PyAPI_FUNC(void) _PyGC_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PySlice_Fini(void);
|
||||||
|
PyAPI_FUNC(void) _PyType_Fini(void);
|
||||||
|
PyAPI_FUNC(void) _PyRandom_Fini(void);
|
||||||
|
|
||||||
|
PyAPI_DATA(PyThreadState *) _Py_Finalizing;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Signals */
|
||||||
|
typedef void (*PyOS_sighandler_t)(int);
|
||||||
|
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
|
||||||
|
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
|
||||||
|
|
||||||
|
/* Random */
|
||||||
|
PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* !Py_PYLIFECYCLE_H */
|
102
include/python3.5m/pymacconfig.h
Normal file
102
include/python3.5m/pymacconfig.h
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
#ifndef PYMACCONFIG_H
|
||||||
|
#define PYMACCONFIG_H
|
||||||
|
/*
|
||||||
|
* This file moves some of the autoconf magic to compile-time
|
||||||
|
* when building on MacOSX. This is needed for building 4-way
|
||||||
|
* universal binaries and for 64-bit universal binaries because
|
||||||
|
* the values redefined below aren't configure-time constant but
|
||||||
|
* only compile-time constant in these scenarios.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
# undef SIZEOF_LONG
|
||||||
|
# undef SIZEOF_PTHREAD_T
|
||||||
|
# undef SIZEOF_SIZE_T
|
||||||
|
# undef SIZEOF_TIME_T
|
||||||
|
# undef SIZEOF_VOID_P
|
||||||
|
# undef SIZEOF__BOOL
|
||||||
|
# undef SIZEOF_UINTPTR_T
|
||||||
|
# undef SIZEOF_PTHREAD_T
|
||||||
|
# undef WORDS_BIGENDIAN
|
||||||
|
# undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754
|
||||||
|
# undef DOUBLE_IS_BIG_ENDIAN_IEEE754
|
||||||
|
# undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754
|
||||||
|
# undef HAVE_GCC_ASM_FOR_X87
|
||||||
|
|
||||||
|
# undef VA_LIST_IS_ARRAY
|
||||||
|
# if defined(__LP64__) && defined(__x86_64__)
|
||||||
|
# define VA_LIST_IS_ARRAY 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# undef HAVE_LARGEFILE_SUPPORT
|
||||||
|
# ifndef __LP64__
|
||||||
|
# define HAVE_LARGEFILE_SUPPORT 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# undef SIZEOF_LONG
|
||||||
|
# ifdef __LP64__
|
||||||
|
# define SIZEOF__BOOL 1
|
||||||
|
# define SIZEOF__BOOL 1
|
||||||
|
# define SIZEOF_LONG 8
|
||||||
|
# define SIZEOF_PTHREAD_T 8
|
||||||
|
# define SIZEOF_SIZE_T 8
|
||||||
|
# define SIZEOF_TIME_T 8
|
||||||
|
# define SIZEOF_VOID_P 8
|
||||||
|
# define SIZEOF_UINTPTR_T 8
|
||||||
|
# define SIZEOF_PTHREAD_T 8
|
||||||
|
# else
|
||||||
|
# ifdef __ppc__
|
||||||
|
# define SIZEOF__BOOL 4
|
||||||
|
# else
|
||||||
|
# define SIZEOF__BOOL 1
|
||||||
|
# endif
|
||||||
|
# define SIZEOF_LONG 4
|
||||||
|
# define SIZEOF_PTHREAD_T 4
|
||||||
|
# define SIZEOF_SIZE_T 4
|
||||||
|
# define SIZEOF_TIME_T 4
|
||||||
|
# define SIZEOF_VOID_P 4
|
||||||
|
# define SIZEOF_UINTPTR_T 4
|
||||||
|
# define SIZEOF_PTHREAD_T 4
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(__LP64__)
|
||||||
|
/* MacOSX 10.4 (the first release to support 64-bit code
|
||||||
|
* at all) only supports 64-bit in the UNIX layer.
|
||||||
|
* Therefore surpress the toolbox-glue in 64-bit mode.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* In 64-bit mode setpgrp always has no argments, in 32-bit
|
||||||
|
* mode that depends on the compilation environment
|
||||||
|
*/
|
||||||
|
# undef SETPGRP_HAVE_ARG
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#ifdef __BIG_ENDIAN__
|
||||||
|
#define WORDS_BIGENDIAN 1
|
||||||
|
#define DOUBLE_IS_BIG_ENDIAN_IEEE754
|
||||||
|
#else
|
||||||
|
#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754
|
||||||
|
#endif /* __BIG_ENDIAN */
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
# define HAVE_GCC_ASM_FOR_X87
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The definition in pyconfig.h is only valid on the OS release
|
||||||
|
* where configure ran on and not necessarily for all systems where
|
||||||
|
* the executable can be used on.
|
||||||
|
*
|
||||||
|
* Specifically: OSX 10.4 has limited supported for '%zd', while
|
||||||
|
* 10.5 has full support for '%zd'. A binary built on 10.5 won't
|
||||||
|
* work properly on 10.4 unless we surpress the definition
|
||||||
|
* of PY_FORMAT_SIZE_T
|
||||||
|
*/
|
||||||
|
#undef PY_FORMAT_SIZE_T
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* defined(_APPLE__) */
|
||||||
|
|
||||||
|
#endif /* PYMACCONFIG_H */
|
91
include/python3.5m/pymacro.h
Normal file
91
include/python3.5m/pymacro.h
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
#ifndef Py_PYMACRO_H
|
||||||
|
#define Py_PYMACRO_H
|
||||||
|
|
||||||
|
/* Minimum value between x and y */
|
||||||
|
#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))
|
||||||
|
|
||||||
|
/* Maximum value between x and y */
|
||||||
|
#define Py_MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
|
|
||||||
|
/* Absolute value of the number x */
|
||||||
|
#define Py_ABS(x) ((x) < 0 ? -(x) : (x))
|
||||||
|
|
||||||
|
#define _Py_XSTRINGIFY(x) #x
|
||||||
|
|
||||||
|
/* Convert the argument to a string. For example, Py_STRINGIFY(123) is replaced
|
||||||
|
with "123" by the preprocessor. Defines are also replaced by their value.
|
||||||
|
For example Py_STRINGIFY(__LINE__) is replaced by the line number, not
|
||||||
|
by "__LINE__". */
|
||||||
|
#define Py_STRINGIFY(x) _Py_XSTRINGIFY(x)
|
||||||
|
|
||||||
|
/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
|
||||||
|
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
|
||||||
|
|
||||||
|
/* Assert a build-time dependency, as an expression.
|
||||||
|
|
||||||
|
Your compile will fail if the condition isn't true, or can't be evaluated
|
||||||
|
by the compiler. This can be used in an expression: its value is 0.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
#define foo_to_char(foo) \
|
||||||
|
((char *)(foo) \
|
||||||
|
+ Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))
|
||||||
|
|
||||||
|
Written by Rusty Russell, public domain, http://ccodearchive.net/ */
|
||||||
|
#define Py_BUILD_ASSERT_EXPR(cond) \
|
||||||
|
(sizeof(char [1 - 2*!(cond)]) - 1)
|
||||||
|
|
||||||
|
/* Get the number of elements in a visible array
|
||||||
|
|
||||||
|
This does not work on pointers, or arrays declared as [], or function
|
||||||
|
parameters. With correct compiler support, such usage will cause a build
|
||||||
|
error (see Py_BUILD_ASSERT_EXPR).
|
||||||
|
|
||||||
|
Written by Rusty Russell, public domain, http://ccodearchive.net/
|
||||||
|
|
||||||
|
Requires at GCC 3.1+ */
|
||||||
|
#if (defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
|
||||||
|
(((__GNUC__ == 3) && (__GNU_MINOR__ >= 1)) || (__GNUC__ >= 4)))
|
||||||
|
/* Two gcc extensions.
|
||||||
|
&a[0] degrades to a pointer: a different type from an array */
|
||||||
|
#define Py_ARRAY_LENGTH(array) \
|
||||||
|
(sizeof(array) / sizeof((array)[0]) \
|
||||||
|
+ Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \
|
||||||
|
typeof(&(array)[0]))))
|
||||||
|
#else
|
||||||
|
#define Py_ARRAY_LENGTH(array) \
|
||||||
|
(sizeof(array) / sizeof((array)[0]))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Define macros for inline documentation. */
|
||||||
|
#define PyDoc_VAR(name) static char name[]
|
||||||
|
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
|
||||||
|
#ifdef WITH_DOC_STRINGS
|
||||||
|
#define PyDoc_STR(str) str
|
||||||
|
#else
|
||||||
|
#define PyDoc_STR(str) ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Below "a" is a power of 2. */
|
||||||
|
/* Round down size "n" to be a multiple of "a". */
|
||||||
|
#define _Py_SIZE_ROUND_DOWN(n, a) ((size_t)(n) & ~(size_t)((a) - 1))
|
||||||
|
/* Round up size "n" to be a multiple of "a". */
|
||||||
|
#define _Py_SIZE_ROUND_UP(n, a) (((size_t)(n) + \
|
||||||
|
(size_t)((a) - 1)) & ~(size_t)((a) - 1))
|
||||||
|
/* Round pointer "p" down to the closest "a"-aligned address <= "p". */
|
||||||
|
#define _Py_ALIGN_DOWN(p, a) ((void *)((Py_uintptr_t)(p) & ~(Py_uintptr_t)((a) - 1)))
|
||||||
|
/* Round pointer "p" up to the closest "a"-aligned address >= "p". */
|
||||||
|
#define _Py_ALIGN_UP(p, a) ((void *)(((Py_uintptr_t)(p) + \
|
||||||
|
(Py_uintptr_t)((a) - 1)) & ~(Py_uintptr_t)((a) - 1)))
|
||||||
|
/* Check if pointer "p" is aligned to "a"-bytes boundary. */
|
||||||
|
#define _Py_IS_ALIGNED(p, a) (!((Py_uintptr_t)(p) & (Py_uintptr_t)((a) - 1)))
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define Py_UNUSED(name) _unused_ ## name __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define Py_UNUSED(name) _unused_ ## name
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Py_PYMACRO_H */
|
212
include/python3.5m/pymath.h
Normal file
212
include/python3.5m/pymath.h
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
#ifndef Py_PYMATH_H
|
||||||
|
#define Py_PYMATH_H
|
||||||
|
|
||||||
|
#include "pyconfig.h" /* include for defines */
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Symbols and macros to supply platform-independent interfaces to mathematical
|
||||||
|
functions and constants
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/* Python provides implementations for copysign, round and hypot in
|
||||||
|
* Python/pymath.c just in case your math library doesn't provide the
|
||||||
|
* functions.
|
||||||
|
*
|
||||||
|
*Note: PC/pyconfig.h defines copysign as _copysign
|
||||||
|
*/
|
||||||
|
#ifndef HAVE_COPYSIGN
|
||||||
|
extern double copysign(double, double);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_ROUND
|
||||||
|
extern double round(double);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_HYPOT
|
||||||
|
extern double hypot(double, double);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* extra declarations */
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#ifndef __STDC__
|
||||||
|
extern double fmod (double, double);
|
||||||
|
extern double frexp (double, int *);
|
||||||
|
extern double ldexp (double, int);
|
||||||
|
extern double modf (double, double *);
|
||||||
|
extern double pow(double, double);
|
||||||
|
#endif /* __STDC__ */
|
||||||
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
|
/* High precision defintion of pi and e (Euler)
|
||||||
|
* The values are taken from libc6's math.h.
|
||||||
|
*/
|
||||||
|
#ifndef Py_MATH_PIl
|
||||||
|
#define Py_MATH_PIl 3.1415926535897932384626433832795029L
|
||||||
|
#endif
|
||||||
|
#ifndef Py_MATH_PI
|
||||||
|
#define Py_MATH_PI 3.14159265358979323846
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_MATH_El
|
||||||
|
#define Py_MATH_El 2.7182818284590452353602874713526625L
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_MATH_E
|
||||||
|
#define Py_MATH_E 2.7182818284590452354
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU
|
||||||
|
register and into a 64-bit memory location, rounding from extended
|
||||||
|
precision to double precision in the process. On other platforms it does
|
||||||
|
nothing. */
|
||||||
|
|
||||||
|
/* we take double rounding as evidence of x87 usage */
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifndef Py_FORCE_DOUBLE
|
||||||
|
# ifdef X87_DOUBLE_ROUNDING
|
||||||
|
PyAPI_FUNC(double) _Py_force_double(double);
|
||||||
|
# define Py_FORCE_DOUBLE(X) (_Py_force_double(X))
|
||||||
|
# else
|
||||||
|
# define Py_FORCE_DOUBLE(X) (X)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_LIMITED_API
|
||||||
|
#ifdef HAVE_GCC_ASM_FOR_X87
|
||||||
|
PyAPI_FUNC(unsigned short) _Py_get_387controlword(void);
|
||||||
|
PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Py_IS_NAN(X)
|
||||||
|
* Return 1 if float or double arg is a NaN, else 0.
|
||||||
|
* Caution:
|
||||||
|
* X is evaluated more than once.
|
||||||
|
* This may not work on all platforms. Each platform has *some*
|
||||||
|
* way to spell this, though -- override in pyconfig.h if you have
|
||||||
|
* a platform where it doesn't work.
|
||||||
|
* Note: PC/pyconfig.h defines Py_IS_NAN as _isnan
|
||||||
|
*/
|
||||||
|
#ifndef Py_IS_NAN
|
||||||
|
#if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1
|
||||||
|
#define Py_IS_NAN(X) isnan(X)
|
||||||
|
#else
|
||||||
|
#define Py_IS_NAN(X) ((X) != (X))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Py_IS_INFINITY(X)
|
||||||
|
* Return 1 if float or double arg is an infinity, else 0.
|
||||||
|
* Caution:
|
||||||
|
* X is evaluated more than once.
|
||||||
|
* This implementation may set the underflow flag if |X| is very small;
|
||||||
|
* it really can't be implemented correctly (& easily) before C99.
|
||||||
|
* Override in pyconfig.h if you have a better spelling on your platform.
|
||||||
|
* Py_FORCE_DOUBLE is used to avoid getting false negatives from a
|
||||||
|
* non-infinite value v sitting in an 80-bit x87 register such that
|
||||||
|
* v becomes infinite when spilled from the register to 64-bit memory.
|
||||||
|
* Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
|
||||||
|
*/
|
||||||
|
#ifndef Py_IS_INFINITY
|
||||||
|
# if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
|
||||||
|
# define Py_IS_INFINITY(X) isinf(X)
|
||||||
|
# else
|
||||||
|
# define Py_IS_INFINITY(X) ((X) && \
|
||||||
|
(Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Py_IS_FINITE(X)
|
||||||
|
* Return 1 if float or double arg is neither infinite nor NAN, else 0.
|
||||||
|
* Some compilers (e.g. VisualStudio) have intrisics for this, so a special
|
||||||
|
* macro for this particular test is useful
|
||||||
|
* Note: PC/pyconfig.h defines Py_IS_FINITE as _finite
|
||||||
|
*/
|
||||||
|
#ifndef Py_IS_FINITE
|
||||||
|
#if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1
|
||||||
|
#define Py_IS_FINITE(X) isfinite(X)
|
||||||
|
#elif defined HAVE_FINITE
|
||||||
|
#define Py_IS_FINITE(X) finite(X)
|
||||||
|
#else
|
||||||
|
#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* HUGE_VAL is supposed to expand to a positive double infinity. Python
|
||||||
|
* uses Py_HUGE_VAL instead because some platforms are broken in this
|
||||||
|
* respect. We used to embed code in pyport.h to try to worm around that,
|
||||||
|
* but different platforms are broken in conflicting ways. If you're on
|
||||||
|
* a platform where HUGE_VAL is defined incorrectly, fiddle your Python
|
||||||
|
* config to #define Py_HUGE_VAL to something that works on your platform.
|
||||||
|
*/
|
||||||
|
#ifndef Py_HUGE_VAL
|
||||||
|
#define Py_HUGE_VAL HUGE_VAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Py_NAN
|
||||||
|
* A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or
|
||||||
|
* INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform
|
||||||
|
* doesn't support NaNs.
|
||||||
|
*/
|
||||||
|
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
|
||||||
|
#if !defined(__INTEL_COMPILER)
|
||||||
|
#define Py_NAN (Py_HUGE_VAL * 0.)
|
||||||
|
#else /* __INTEL_COMPILER */
|
||||||
|
#if defined(ICC_NAN_STRICT)
|
||||||
|
#pragma float_control(push)
|
||||||
|
#pragma float_control(precise, on)
|
||||||
|
#pragma float_control(except, on)
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
__declspec(noinline)
|
||||||
|
#else /* Linux */
|
||||||
|
__attribute__((noinline))
|
||||||
|
#endif /* _MSC_VER */
|
||||||
|
static double __icc_nan()
|
||||||
|
{
|
||||||
|
return sqrt(-1.0);
|
||||||
|
}
|
||||||
|
#pragma float_control (pop)
|
||||||
|
#define Py_NAN __icc_nan()
|
||||||
|
#else /* ICC_NAN_RELAXED as default for Intel Compiler */
|
||||||
|
static union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f};
|
||||||
|
#define Py_NAN (__nan_store.__icc_nan)
|
||||||
|
#endif /* ICC_NAN_STRICT */
|
||||||
|
#endif /* __INTEL_COMPILER */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Py_OVERFLOWED(X)
|
||||||
|
* Return 1 iff a libm function overflowed. Set errno to 0 before calling
|
||||||
|
* a libm function, and invoke this macro after, passing the function
|
||||||
|
* result.
|
||||||
|
* Caution:
|
||||||
|
* This isn't reliable. C99 no longer requires libm to set errno under
|
||||||
|
* any exceptional condition, but does require +- HUGE_VAL return
|
||||||
|
* values on overflow. A 754 box *probably* maps HUGE_VAL to a
|
||||||
|
* double infinity, and we're cool if that's so, unless the input
|
||||||
|
* was an infinity and an infinity is the expected result. A C89
|
||||||
|
* system sets errno to ERANGE, so we check for that too. We're
|
||||||
|
* out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or
|
||||||
|
* if the returned result is a NaN, or if a C89 box returns HUGE_VAL
|
||||||
|
* in non-overflow cases.
|
||||||
|
* X is evaluated more than once.
|
||||||
|
* Some platforms have better way to spell this, so expect some #ifdef'ery.
|
||||||
|
*
|
||||||
|
* OpenBSD uses 'isinf()' because a compiler bug on that platform causes
|
||||||
|
* the longer macro version to be mis-compiled. This isn't optimal, and
|
||||||
|
* should be removed once a newer compiler is available on that platform.
|
||||||
|
* The system that had the failure was running OpenBSD 3.2 on Intel, with
|
||||||
|
* gcc 2.95.3.
|
||||||
|
*
|
||||||
|
* According to Tim's checkin, the FreeBSD systems use isinf() to work
|
||||||
|
* around a FPE bug on that platform.
|
||||||
|
*/
|
||||||
|
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
|
#define Py_OVERFLOWED(X) isinf(X)
|
||||||
|
#else
|
||||||
|
#define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \
|
||||||
|
(X) == Py_HUGE_VAL || \
|
||||||
|
(X) == -Py_HUGE_VAL))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Py_PYMATH_H */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue