Make numerous improvements

- Python static hello world now 1.8mb
- Python static fully loaded now 10mb
- Python HTTPS client now uses MbedTLS
- Python REPL now completes import stmts
- Increase stack size for Python for now
- Begin synthesizing posixpath and ntpath
- Restore Python \N{UNICODE NAME} support
- Restore Python NFKD symbol normalization
- Add optimized code path for Intel SHA-NI
- Get more Python unit tests passing faster
- Get Python help() pagination working on NT
- Python hashlib now supports MbedTLS PBKDF2
- Make memcpy/memmove/memcmp/bcmp/etc. faster
- Add Mersenne Twister and Vigna to LIBC_RAND
- Provide privileged __printf() for error code
- Fix zipos opendir() so that it reports ENOTDIR
- Add basic chmod() implementation for Windows NT
- Add Cosmo's best functions to Python cosmo module
- Pin function trace indent depth to that of caller
- Show memory diagram on invalid access in MODE=dbg
- Differentiate stack overflow on crash in MODE=dbg
- Add stb_truetype and tools for analyzing font files
- Upgrade to UNICODE 13 and reduce its binary footprint
- COMPILE.COM now logs resource usage of build commands
- Start implementing basic poll() support on bare metal
- Set getauxval(AT_EXECFN) to GetModuleFileName() on NT
- Add descriptions to strerror() in non-TINY build modes
- Add COUNTBRANCH() macro to help with micro-optimizations
- Make error / backtrace / asan / memory code more unbreakable
- Add fast perfect C implementation of μ-Law and a-Law audio codecs
- Make strtol() functions consistent with other libc implementations
- Improve Linenoise implementation (see also github.com/jart/bestline)
- COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
Justine Tunney 2021-09-27 22:58:51 -07:00
parent fa7b4f5bd1
commit 39bf41f4eb
806 changed files with 77494 additions and 63859 deletions

View file

@ -1,61 +0,0 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/
#if (OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER))
PyDoc_STRVAR(_hashlib_scrypt__doc__,
"scrypt($module, /, password, *, salt=None, n=None, r=None, p=None,\n"
" maxmem=0, dklen=64)\n"
"--\n"
"\n"
"scrypt password-based key derivation function.");
#define _HASHLIB_SCRYPT_METHODDEF \
{"scrypt", (PyCFunction)_hashlib_scrypt, METH_FASTCALL, _hashlib_scrypt__doc__},
static PyObject *
_hashlib_scrypt_impl(PyObject *module, Py_buffer *password, Py_buffer *salt,
PyObject *n_obj, PyObject *r_obj, PyObject *p_obj,
long maxmem, long dklen);
static PyObject *
_hashlib_scrypt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"password", "salt", "n", "r", "p", "maxmem", "dklen", NULL};
static _PyArg_Parser _parser = {"y*|$y*O!O!O!ll:scrypt", _keywords, 0};
Py_buffer password = {NULL, NULL};
Py_buffer salt = {NULL, NULL};
PyObject *n_obj = Py_None;
PyObject *r_obj = Py_None;
PyObject *p_obj = Py_None;
long maxmem = 0;
long dklen = 64;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&password, &salt, &PyLong_Type, &n_obj, &PyLong_Type, &r_obj, &PyLong_Type, &p_obj, &maxmem, &dklen)) {
goto exit;
}
return_value = _hashlib_scrypt_impl(module, &password, &salt, n_obj, r_obj, p_obj, maxmem, dklen);
exit:
/* Cleanup for password */
if (password.obj) {
PyBuffer_Release(&password);
}
/* Cleanup for salt */
if (salt.obj) {
PyBuffer_Release(&salt);
}
return return_value;
}
#endif /* (OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER)) */
#ifndef _HASHLIB_SCRYPT_METHODDEF
#define _HASHLIB_SCRYPT_METHODDEF
#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
/*[clinic end generated code: output=118cd7036fa0fb52 input=a9049054013a1b77]*/

View file

@ -843,19 +843,15 @@ audioop_alaw2lin(PyObject *module, PyObject *args)
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
int width;
if (!PyArg_ParseTuple(args, "y*i:alaw2lin",
&fragment, &width)) {
if (!PyArg_ParseTuple(args, "y*i:alaw2lin", &fragment, &width)) {
goto exit;
}
return_value = audioop_alaw2lin_impl(module, &fragment, width);
exit:
/* Cleanup for fragment */
if (fragment.obj) {
PyBuffer_Release(&fragment);
}
return return_value;
}

View file

@ -1,98 +0,0 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(MD5Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define MD5TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)MD5Type_copy, METH_NOARGS, MD5Type_copy__doc__},
static PyObject *
MD5Type_copy_impl(MD5object *self);
static PyObject *
MD5Type_copy(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_copy_impl(self);
}
PyDoc_STRVAR(MD5Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a bytes object.");
#define MD5TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)MD5Type_digest, METH_NOARGS, MD5Type_digest__doc__},
static PyObject *
MD5Type_digest_impl(MD5object *self);
static PyObject *
MD5Type_digest(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_digest_impl(self);
}
PyDoc_STRVAR(MD5Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define MD5TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)MD5Type_hexdigest, METH_NOARGS, MD5Type_hexdigest__doc__},
static PyObject *
MD5Type_hexdigest_impl(MD5object *self);
static PyObject *
MD5Type_hexdigest(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_hexdigest_impl(self);
}
PyDoc_STRVAR(MD5Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define MD5TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)MD5Type_update, METH_O, MD5Type_update__doc__},
PyDoc_STRVAR(_md5_md5__doc__,
"md5($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new MD5 hash object; optionally initialized with a string.");
#define _MD5_MD5_METHODDEF \
{"md5", (PyCFunction)_md5_md5, METH_FASTCALL, _md5_md5__doc__},
static PyObject *
_md5_md5_impl(PyObject *module, PyObject *string);
static PyObject *
_md5_md5(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:md5", _keywords, 0};
PyObject *string = NULL;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&string)) {
goto exit;
}
return_value = _md5_md5_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=1761d10cec19a4c2 input=a9049054013a1b77]*/

View file

@ -967,8 +967,6 @@ exit:
#endif /* defined(MS_WINDOWS) */
#if defined(MS_WINDOWS)
PyDoc_STRVAR(os__getfinalpathname__doc__,
"_getfinalpathname($module, path, /)\n"
"--\n"
@ -986,18 +984,14 @@ os__getfinalpathname(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
PyObject *path;
if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) {
goto exit;
}
return_value = os__getfinalpathname_impl(module, path);
exit:
return return_value;
}
#endif /* defined(MS_WINDOWS) */
#if defined(MS_WINDOWS)
PyDoc_STRVAR(os__isdir__doc__,
@ -1017,23 +1011,18 @@ os__isdir(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
path_t path = PATH_T_INITIALIZE("_isdir", "path", 0, 0);
if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) {
goto exit;
}
return_value = os__isdir_impl(module, &path);
exit:
/* Cleanup for path */
path_cleanup(&path);
return return_value;
}
#endif /* defined(MS_WINDOWS) */
#if defined(MS_WINDOWS)
PyDoc_STRVAR(os__getvolumepathname__doc__,
"_getvolumepathname($module, /, path)\n"
"--\n"
@ -1053,19 +1042,15 @@ os__getvolumepathname(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObj
static const char * const _keywords[] = {"path", NULL};
static _PyArg_Parser _parser = {"U:_getvolumepathname", _keywords, 0};
PyObject *path;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&path)) {
goto exit;
}
return_value = os__getvolumepathname_impl(module, path);
exit:
return return_value;
}
#endif /* defined(MS_WINDOWS) */
PyDoc_STRVAR(os_mkdir__doc__,
"mkdir($module, /, path, mode=511, *, dir_fd=None)\n"
"--\n"

View file

@ -1,98 +0,0 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(SHA1Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA1TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA1Type_copy, METH_NOARGS, SHA1Type_copy__doc__},
static PyObject *
SHA1Type_copy_impl(SHA1object *self);
static PyObject *
SHA1Type_copy(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_copy_impl(self);
}
PyDoc_STRVAR(SHA1Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a bytes object.");
#define SHA1TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA1Type_digest, METH_NOARGS, SHA1Type_digest__doc__},
static PyObject *
SHA1Type_digest_impl(SHA1object *self);
static PyObject *
SHA1Type_digest(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_digest_impl(self);
}
PyDoc_STRVAR(SHA1Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA1TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA1Type_hexdigest, METH_NOARGS, SHA1Type_hexdigest__doc__},
static PyObject *
SHA1Type_hexdigest_impl(SHA1object *self);
static PyObject *
SHA1Type_hexdigest(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_hexdigest_impl(self);
}
PyDoc_STRVAR(SHA1Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA1TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA1Type_update, METH_O, SHA1Type_update__doc__},
PyDoc_STRVAR(_sha1_sha1__doc__,
"sha1($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA1 hash object; optionally initialized with a string.");
#define _SHA1_SHA1_METHODDEF \
{"sha1", (PyCFunction)_sha1_sha1, METH_FASTCALL, _sha1_sha1__doc__},
static PyObject *
_sha1_sha1_impl(PyObject *module, PyObject *string);
static PyObject *
_sha1_sha1(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha1", _keywords, 0};
PyObject *string = NULL;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&string)) {
goto exit;
}
return_value = _sha1_sha1_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=34e9cee5761f2a36 input=a9049054013a1b77]*/

View file

@ -1,128 +0,0 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(SHA256Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA256TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA256Type_copy, METH_NOARGS, SHA256Type_copy__doc__},
static PyObject *
SHA256Type_copy_impl(SHAobject *self);
static PyObject *
SHA256Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_copy_impl(self);
}
PyDoc_STRVAR(SHA256Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a bytes object.");
#define SHA256TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA256Type_digest, METH_NOARGS, SHA256Type_digest__doc__},
static PyObject *
SHA256Type_digest_impl(SHAobject *self);
static PyObject *
SHA256Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_digest_impl(self);
}
PyDoc_STRVAR(SHA256Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA256TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA256Type_hexdigest, METH_NOARGS, SHA256Type_hexdigest__doc__},
static PyObject *
SHA256Type_hexdigest_impl(SHAobject *self);
static PyObject *
SHA256Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_hexdigest_impl(self);
}
PyDoc_STRVAR(SHA256Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA256TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA256Type_update, METH_O, SHA256Type_update__doc__},
PyDoc_STRVAR(_sha256_sha256__doc__,
"sha256($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-256 hash object; optionally initialized with a string.");
#define _SHA256_SHA256_METHODDEF \
{"sha256", (PyCFunction)_sha256_sha256, METH_FASTCALL, _sha256_sha256__doc__},
static PyObject *
_sha256_sha256_impl(PyObject *module, PyObject *string);
static PyObject *
_sha256_sha256(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0};
PyObject *string = NULL;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&string)) {
goto exit;
}
return_value = _sha256_sha256_impl(module, string);
exit:
return return_value;
}
PyDoc_STRVAR(_sha256_sha224__doc__,
"sha224($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-224 hash object; optionally initialized with a string.");
#define _SHA256_SHA224_METHODDEF \
{"sha224", (PyCFunction)_sha256_sha224, METH_FASTCALL, _sha256_sha224__doc__},
static PyObject *
_sha256_sha224_impl(PyObject *module, PyObject *string);
static PyObject *
_sha256_sha224(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0};
PyObject *string = NULL;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&string)) {
goto exit;
}
return_value = _sha256_sha224_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=3babbe1e753c1a38 input=a9049054013a1b77]*/

View file

@ -1,128 +0,0 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(SHA512Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA512TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA512Type_copy, METH_NOARGS, SHA512Type_copy__doc__},
static PyObject *
SHA512Type_copy_impl(SHAobject *self);
static PyObject *
SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_copy_impl(self);
}
PyDoc_STRVAR(SHA512Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a bytes object.");
#define SHA512TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA512Type_digest, METH_NOARGS, SHA512Type_digest__doc__},
static PyObject *
SHA512Type_digest_impl(SHAobject *self);
static PyObject *
SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_digest_impl(self);
}
PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA512TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA512Type_hexdigest, METH_NOARGS, SHA512Type_hexdigest__doc__},
static PyObject *
SHA512Type_hexdigest_impl(SHAobject *self);
static PyObject *
SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_hexdigest_impl(self);
}
PyDoc_STRVAR(SHA512Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA512TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
PyDoc_STRVAR(_sha512_sha512__doc__,
"sha512($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-512 hash object; optionally initialized with a string.");
#define _SHA512_SHA512_METHODDEF \
{"sha512", (PyCFunction)_sha512_sha512, METH_FASTCALL, _sha512_sha512__doc__},
static PyObject *
_sha512_sha512_impl(PyObject *module, PyObject *string);
static PyObject *
_sha512_sha512(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0};
PyObject *string = NULL;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&string)) {
goto exit;
}
return_value = _sha512_sha512_impl(module, string);
exit:
return return_value;
}
PyDoc_STRVAR(_sha512_sha384__doc__,
"sha384($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-384 hash object; optionally initialized with a string.");
#define _SHA512_SHA384_METHODDEF \
{"sha384", (PyCFunction)_sha512_sha384, METH_FASTCALL, _sha512_sha384__doc__},
static PyObject *
_sha512_sha384_impl(PyObject *module, PyObject *string);
static PyObject *
_sha512_sha384(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0};
PyObject *string = NULL;
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
&string)) {
goto exit;
}
return_value = _sha512_sha384_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=59a43fa6eb3b5f4f input=a9049054013a1b77]*/

View file

@ -111,7 +111,8 @@ PyDoc_STRVAR(zlib_compressobj__doc__,
" usage, faster compression, and smaller output.\n"
" strategy\n"
" Used to tune the compression algorithm. Possible values are\n"
" Z_DEFAULT_STRATEGY, Z_FILTERED, and Z_HUFFMAN_ONLY.\n"
" Z_DEFAULT_STRATEGY, Z_RLE, Z_HUFFMAN_ONLY, Z_FILTERED, and\n"
" Z_FIXED.\n"
" zdict\n"
" The predefined compression dictionary - a sequence of bytes\n"
" containing subsequences that are likely to occur in the input data.");