Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ iOS/testbed/Python.xcframework/ios-*/lib
iOS/testbed/Python.xcframework/ios-*/Python.framework
iOS/testbed/iOSTestbed.xcodeproj/project.xcworkspace
iOS/testbed/iOSTestbed.xcodeproj/xcuserdata
iOS/testbed/iOSTestbed.xcodeproj/xcshareddata
Mac/Makefile
Mac/PythonLauncher/Info.plist
Mac/PythonLauncher/Makefile
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ the following methods and attributes:

.. method:: window.attron(attr)

Add attribute *attr* from the "background" set applied to all writes to the
Add attribute *attr* to the "background" set applied to all writes to the
current window.


Expand Down
11 changes: 11 additions & 0 deletions Doc/using/ios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,17 @@ You can also open the testbed project in Xcode by running:
This will allow you to use the full Xcode suite of tools for debugging.

The arguments used to run the test suite are defined as part of the test plan.
To modify the test plan, select the test plan node of the project tree (it
should be the first child of the root node), and select the "Configurations"
tab. Modify the "Arguments Passed On Launch" value to change the testing
arguments.

The test plan also disables parallel testing, and specifies the use of the
``iOSTestbed.lldbinit`` file for providing configuration of the debugger. The
default debugger configuration disables automatic breakpoints on the
``SIGINT``, ``SIGUSR1``, ``SIGUSR2``, and ``SIGXFSZ`` signals.

App Store Compliance
====================

Expand Down
28 changes: 14 additions & 14 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Summary -- release highlights
.. This section singles out the most important changes in Python 3.14.
Brevity is key.

Python 3.14 beta is the pre-release of the next version of the Python
Python 3.14 will be the latest stable release of the Python
programming language, with a mix of changes to the language, the
implementation and the standard library.

Expand Down Expand Up @@ -635,7 +635,7 @@ Improved error messages
misspellings may still result in regular syntax errors.
(Contributed by Pablo Galindo in :gh:`132449`.)

* When unpacking assignment fails due to incorrect number of variables, the
* When an unpacking assignment fails due to an incorrect number of variables, the
error message prints the received number of values in more cases than before.
(Contributed by Tushar Sadhwani in :gh:`122239`.)

Expand Down Expand Up @@ -763,7 +763,7 @@ ABI-compatible changes in the future.

Complete the :pep:`587` :ref:`PyConfig C API <pyconfig_api>` by adding
:c:func:`PyInitConfig_AddModule` which can be used to add a built-in extension
module; feature previously referred to as the “inittab”.
module; a feature previously referred to as the “inittab”.

Add :c:func:`PyConfig_Get` and :c:func:`PyConfig_Set` functions to get and set
the current runtime configuration.
Expand Down Expand Up @@ -1051,7 +1051,7 @@ Concurrent safe warnings control
The :class:`warnings.catch_warnings` context manager will now optionally
use a context variable for warning filters. This is enabled by setting
the :data:`~sys.flags.context_aware_warnings` flag, either with the ``-X``
command-line option or an environment variable. This gives predicable
command-line option or an environment variable. This gives predictable
warnings control when using :class:`~warnings.catch_warnings` combined with
multiple threads or asynchronous tasks. The flag defaults to true for the
free-threaded build and false for the GIL-enabled build.
Expand Down Expand Up @@ -1152,7 +1152,7 @@ Other language changes
unlike ``\Z``, which has subtly different behavior.
(Contributed by Serhiy Storchaka in :gh:`133306`.)

* ``\B`` in :mod:`regular expression <re>` now matches empty input string.
* ``\B`` in :mod:`regular expression <re>` now matches the empty input string.
Now it is always the opposite of ``\b``.
(Contributed by Serhiy Storchaka in :gh:`124130`.)

Expand Down Expand Up @@ -1221,7 +1221,7 @@ PEP 765: Disallow ``return``/``break``/``continue`` that exit a ``finally`` bloc
---------------------------------------------------------------------------------

The compiler emits a :exc:`SyntaxWarning` when a :keyword:`return`, :keyword:`break` or
:keyword:`continue` statements appears where it exits a :keyword:`finally` block.
:keyword:`continue` statement appears where it exits a :keyword:`finally` block.
This change is specified in :pep:`765`.


Expand Down Expand Up @@ -1278,7 +1278,7 @@ ast
(Contributed by Irit Katriel in :gh:`130139`.)

* Add new ``--feature-version``, ``--optimize``, ``--show-empty`` options to
command-line interface.
the command-line interface.
(Contributed by Semyon Moroz in :gh:`133367`.)


Expand Down Expand Up @@ -2157,7 +2157,7 @@ unittest
:meth:`~unittest.TestCase.assertNotStartsWith`,
:meth:`~unittest.TestCase.assertEndsWith` and
:meth:`~unittest.TestCase.assertNotEndsWith` check whether the Unicode
or byte string starts or ends with particular string(s).
or byte string starts or ends with particular strings.

(Contributed by Serhiy Storchaka in :gh:`71339`.)

Expand Down Expand Up @@ -2223,15 +2223,15 @@ webbrowser
supported browsers on macOS.


zipinfo
zipfile
-------

* Added :func:`ZipInfo._for_archive <zipfile.ZipInfo._for_archive>`
to resolve suitable defaults for a :class:`~zipfile.ZipInfo` object
as used by :func:`ZipFile.writestr <zipfile.ZipFile.writestr>`.
(Contributed by Bénédikt Tran in :gh:`123424`.)

* :meth:`zipfile.ZipFile.writestr` now respect ``SOURCE_DATE_EPOCH`` that
* :meth:`zipfile.ZipFile.writestr` now respects ``SOURCE_DATE_EPOCH`` that
distributions can set centrally and have build tools consume this in order
to produce reproducible output.
(Contributed by Jiahao Li in :gh:`91279`.)
Expand Down Expand Up @@ -2379,7 +2379,7 @@ zlib
* On Windows, `zlib-ng <https://github.com/zlib-ng/zlib-ng>`__
is now used as the implementation of the :mod:`zlib` module
in the default binaries.
There are no known incompatabilities between ``zlib-ng``
There are no known incompatibilities between ``zlib-ng``
and the previously-used ``zlib`` implementation.
This should result in better performance at all compression levels.

Expand Down Expand Up @@ -2839,7 +2839,7 @@ Changes in the Python API
rather than collecting generation 1.
* Other calls to :func:`!gc.collect` are unchanged.

* The :func:`locale.nl_langinfo` function now sets temporarily the ``LC_CTYPE``
* The :func:`locale.nl_langinfo` function now temporarily sets the ``LC_CTYPE``
locale in some cases.
This temporary change affects other threads.
(Contributed by Serhiy Storchaka in :gh:`69998`.)
Expand Down Expand Up @@ -3019,8 +3019,8 @@ New features
and get an attribute of the module.
(Contributed by Victor Stinner in :gh:`128911`.)

* Add support for a new ``p`` format unit in :c:func:`Py_BuildValue` that allows to
take a C integer and produce a Python :class:`bool` object. (Contributed by
* Add support for a new ``p`` format unit in :c:func:`Py_BuildValue` that allows
taking a C integer and produces a Python :class:`bool` object. (Contributed by
Pablo Galindo in :issue:`45325`.)

* Add :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` to determine if an object
Expand Down
3 changes: 2 additions & 1 deletion Lib/json/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def main():
'to validate and pretty-print JSON objects.')
parser = argparse.ArgumentParser(description=description, color=True)
parser.add_argument('infile', nargs='?',
help='a JSON file to be validated or pretty-printed',
help='a JSON file to be validated or pretty-printed; '
'defaults to stdin',
default='-')
parser.add_argument('outfile', nargs='?',
help='write the output of infile to outfile',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The iOS test runner has been simplified, resolving some issues that have
been observed using the runner in GitHub Actions and Azure Pipelines test
environments.
4 changes: 2 additions & 2 deletions Modules/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,12 +1298,12 @@ _curses.window.attron
attr: long
/

Add attribute attr from the "background" set.
Add attribute attr to the "background" set.
[clinic start generated code]*/

static PyObject *
_curses_window_attron_impl(PyCursesWindowObject *self, long attr)
/*[clinic end generated code: output=7afea43b237fa870 input=5a88fba7b1524f32]*/
/*[clinic end generated code: output=7afea43b237fa870 input=b57f824e1bf58326]*/
{
int rtn = wattron(self->win, (attr_t)attr);
return curses_window_check_err(self, rtn, "wattron", "attron");
Expand Down
80 changes: 45 additions & 35 deletions Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1939,20 +1939,30 @@ locked_HMAC_CTX_copy(HMAC_CTX *new_ctx_p, HMACobject *self)
return 0;
}

/* returning 0 means that an error occurred and an exception is set */
#define BAD_DIGEST_SIZE 0

/*
* Return the digest size in bytes.
*
* On error, set an exception and return BAD_DIGEST_SIZE.
*/
static unsigned int
_hashlib_hmac_digest_size(HMACobject *self)
{
const EVP_MD *md = _hashlib_hmac_get_md(self);
if (md == NULL) {
return 0;
return BAD_DIGEST_SIZE;
}
unsigned int digest_size = EVP_MD_size(md);
assert(digest_size <= EVP_MAX_MD_SIZE);
int digest_size = EVP_MD_size(md);
/* digest_size < 0 iff EVP_MD context is NULL (which is impossible here) */
assert(digest_size >= 0);
assert(digest_size <= (int)EVP_MAX_MD_SIZE);
/* digest_size == 0 means that the context is not entirely initialized */
if (digest_size == 0) {
notify_ssl_error_occurred("invalid digest size");
raise_ssl_error(PyExc_ValueError, "missing digest size");
return BAD_DIGEST_SIZE;
}
return digest_size;
return (unsigned int)digest_size;
}

static int
Expand Down Expand Up @@ -2053,24 +2063,38 @@ _hashlib_HMAC_update_impl(HMACobject *self, PyObject *msg)
Py_RETURN_NONE;
}

static int
_hmac_digest(HMACobject *self, unsigned char *buf, unsigned int len)
/*
* Extract the MAC value to 'buf' and return the digest size.
*
* The buffer 'buf' must have at least hashlib_openssl_HMAC_digest_size(self)
* bytes. Smaller buffers lead to undefined behaviors.
*
* On error, set an exception and return -1.
*/
static Py_ssize_t
_hmac_digest(HMACobject *self, unsigned char *buf)
{
unsigned int digest_size = _hashlib_hmac_digest_size(self);
assert(digest_size <= EVP_MAX_MD_SIZE);
if (digest_size == BAD_DIGEST_SIZE) {
assert(PyErr_Occurred());
return -1;
}
HMAC_CTX *temp_ctx = py_openssl_wrapper_HMAC_CTX_new();
if (temp_ctx == NULL) {
return 0;
return -1;
}
if (locked_HMAC_CTX_copy(temp_ctx, self) < 0) {
HMAC_CTX_free(temp_ctx);
return 0;
return -1;
}
int r = HMAC_Final(temp_ctx, buf, &len);
int r = HMAC_Final(temp_ctx, buf, NULL);
HMAC_CTX_free(temp_ctx);
if (r == 0) {
notify_ssl_error_occurred_in(Py_STRINGIFY(HMAC_Final));
return 0;
return -1;
}
return 1;
return digest_size;
}

/*[clinic input]
Expand All @@ -2082,16 +2106,9 @@ static PyObject *
_hashlib_HMAC_digest_impl(HMACobject *self)
/*[clinic end generated code: output=1b1424355af7a41e input=bff07f74da318fb4]*/
{
unsigned char digest[EVP_MAX_MD_SIZE];
unsigned int digest_size = _hashlib_hmac_digest_size(self);
if (digest_size == 0) {
return NULL;
}
int r = _hmac_digest(self, digest, digest_size);
if (r == 0) {
return NULL;
}
return PyBytes_FromStringAndSize((const char *)digest, digest_size);
unsigned char buf[EVP_MAX_MD_SIZE];
Py_ssize_t n = _hmac_digest(self, buf);
return n < 0 ? NULL : PyBytes_FromStringAndSize((const char *)buf, n);
}

/*[clinic input]
Expand All @@ -2109,24 +2126,17 @@ static PyObject *
_hashlib_HMAC_hexdigest_impl(HMACobject *self)
/*[clinic end generated code: output=80d825be1eaae6a7 input=5e48db83ab1a4d19]*/
{
unsigned char digest[EVP_MAX_MD_SIZE];
unsigned int digest_size = _hashlib_hmac_digest_size(self);
if (digest_size == 0) {
return NULL;
}
int r = _hmac_digest(self, digest, digest_size);
if (r == 0) {
return NULL;
}
return _Py_strhex((const char *)digest, digest_size);
unsigned char buf[EVP_MAX_MD_SIZE];
Py_ssize_t n = _hmac_digest(self, buf);
return n < 0 ? NULL : _Py_strhex((const char *)buf, n);
}

static PyObject *
_hashlib_hmac_get_digest_size(PyObject *op, void *Py_UNUSED(closure))
{
HMACobject *self = HMACobject_CAST(op);
unsigned int digest_size = _hashlib_hmac_digest_size(self);
return digest_size == 0 ? NULL : PyLong_FromLong(digest_size);
unsigned int size = _hashlib_hmac_digest_size(self);
return size == BAD_DIGEST_SIZE ? NULL : PyLong_FromLong(size);
}

static PyObject *
Expand Down
4 changes: 2 additions & 2 deletions Modules/clinic/_cursesmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading