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
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributing to Python
Build Status
------------

- `Buildbot status overview <https://buildbot.python.org/all/#/release_status>`_
- `Buildbot status overview <https://buildbot.python.org/#/release_status>`_

- `GitHub Actions status <https://github.com/python/cpython/actions/workflows/build.yml>`_

Expand Down
2 changes: 1 addition & 1 deletion Android/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def unpack_deps(host, prefix_dir):
os.chdir(prefix_dir)
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.15-4",
"sqlite-3.49.1-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
filename = f"{name_ver}-{host}.tar.gz"
download(f"{deps_url}/{name_ver}/{filename}")
shutil.unpack_archive(filename)
Expand Down
19 changes: 8 additions & 11 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,11 @@
'image': '_static/og-image.png',
'line_color': '#3776ab',
}
if 'builder_html' in tags: # noqa: F821
ogp_custom_meta_tags = [
'<meta name="theme-color" content="#3776ab">',
]
if 'create-social-cards' not in tags: # noqa: F821
# Define a static preview image when not creating social cards
ogp_image = '_static/og-image.png'
ogp_custom_meta_tags += [
'<meta property="og:image:width" content="200">',
'<meta property="og:image:height" content="200">',
]
ogp_custom_meta_tags = ('<meta name="theme-color" content="#3776ab">',)
if 'create-social-cards' not in tags: # noqa: F821
# Define a static preview image when not creating social cards
ogp_image = '_static/og-image.png'
ogp_custom_meta_tags += (
'<meta property="og:image:width" content="200">',
'<meta property="og:image:height" content="200">',
)
37 changes: 31 additions & 6 deletions Doc/extending/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,37 @@ the module and a copyright notice if you like).
See :ref:`arg-parsing-string-and-buffers` for a description of this macro.

All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
``PY``, except those defined in standard header files. For convenience, and
since they are used extensively by the Python interpreter, ``"Python.h"``
includes a few standard header files: ``<stdio.h>``, ``<string.h>``,
``<errno.h>``, and ``<stdlib.h>``. If the latter header file does not exist on
your system, it declares the functions :c:func:`malloc`, :c:func:`free` and
:c:func:`realloc` directly.
``PY``, except those defined in standard header files.

.. tip::

For backward compatibility, :file:`Python.h` includes several standard header files.
C extensions should include the standard headers that they use,
and should not rely on these implicit includes.
If using the limited C API version 3.13 or newer, the implicit includes are:

* ``<assert.h>``
* ``<intrin.h>`` (on Windows)
* ``<inttypes.h>``
* ``<limits.h>``
* ``<math.h>``
* ``<stdarg.h>``
* ``<wchar.h>``
* ``<sys/types.h>`` (if present)

If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or older,
the headers below are also included:

* ``<ctype.h>``
* ``<unistd.h>`` (on POSIX)

If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or older,
the headers below are also included:

* ``<errno.h>``
* ``<stdio.h>``
* ``<stdlib.h>``
* ``<string.h>``

The next thing we add to our module file is the C function that will be called
when the Python expression ``spam.system(string)`` is evaluated (we'll see
Expand Down
10 changes: 10 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ Glossary
with :term:`abstract base classes <abstract base class>`.) Instead, it
typically employs :func:`hasattr` tests or :term:`EAFP` programming.

dunder
An informal short-hand for "double underscore", used when talking about a
:term:`special method`. For example, ``__init__`` is often pronounced
"dunder init".

EAFP
Easier to ask for forgiveness than permission. This common Python coding
style assumes the existence of valid keys or attributes and catches
Expand Down Expand Up @@ -1474,6 +1479,11 @@ Glossary
A computer defined entirely in software. Python's virtual machine
executes the :term:`bytecode` emitted by the bytecode compiler.

walrus operator
A light-hearted way to refer to the :ref:`assignment expression
<assignment-expressions>` operator ``:=`` because it looks a bit like a
walrus if you turn your head.

Zen of Python
Listing of Python design principles and philosophies that are helpful in
understanding and using the language. The listing can be found by typing
Expand Down
2 changes: 1 addition & 1 deletion Doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sphinx~=8.2.0

blurb

sphinxext-opengraph~=0.11.0
sphinxext-opengraph~=0.12.0
sphinx-notfound-page~=1.0.0

# The theme used by the documentation is stored separately, so we need
Expand Down
1 change: 1 addition & 0 deletions Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


// Include standard header files
// When changing these files, remember to update Doc/extending/extending.rst.
#include <assert.h> // assert()
#include <inttypes.h> // uintptr_t
#include <limits.h> // INT_MAX
Expand Down
3 changes: 2 additions & 1 deletion Include/internal/pycore_magic_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ Known values:
Python 3.15a1 3651 (Simplify LOAD_CONST)
Python 3.15a1 3652 (Virtual iterators)
Python 3.15a1 3653 (Fix handling of opcodes that may leave operands on the stack when optimizing LOAD_FAST)
Python 3.15a1 3654 (Fix missing exception handlers in logical expression)


Python 3.16 will start with 3700
Expand All @@ -294,7 +295,7 @@ PC/launcher.c must also be updated.

*/

#define PYC_MAGIC_NUMBER 3653
#define PYC_MAGIC_NUMBER 3654
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
(little-endian) and then appending b'\r\n'. */
#define PYC_MAGIC_NUMBER_TOKEN \
Expand Down
15 changes: 15 additions & 0 deletions Lib/test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,21 @@ def test_compound(self):
self.assertIs(res, v[3])
self.assertEqual([e.called for e in v], [1, 1, 0, 1, 0])

def test_exception(self):
# See gh-137288
class Foo:
def __bool__(self):
raise NotImplementedError()

a = Foo()
b = Foo()

with self.assertRaises(NotImplementedError):
bool(a)

with self.assertRaises(NotImplementedError):
c = a or b

@requires_debug_ranges()
class TestSourcePositions(unittest.TestCase):
# Ensure that compiled code snippets have correct line and column numbers
Expand Down
6 changes: 3 additions & 3 deletions Mac/BuildScript/build-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ def library_recipes():
),
),
dict(
name="SQLite 3.49.1",
url="https://sqlite.org/2025/sqlite-autoconf-3490100.tar.gz",
checksum="106642d8ccb36c5f7323b64e4152e9b719f7c0215acf5bfeac3d5e7f97b59254",
name="SQLite 3.50.4",
url="https://www.sqlite.org/2025/sqlite-autoconf-3500400.tar.gz",
checksum="a3db587a1b92ee5ddac2f66b3edb41b26f9c867275782d46c3a088977d6a5b18",
extra_cflags=('-Os '
'-DSQLITE_ENABLE_FTS5 '
'-DSQLITE_ENABLE_FTS4 '
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix bug where some bytecode instructions of a boolean expression are not
associated with the correct exception handler.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Windows installer to ship with SQLite 3.50.4.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update macOS installer to ship with SQLite version 3.50.4.
8 changes: 4 additions & 4 deletions Misc/externals.spdx.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "e335aeb44fa36cde60ecbb6a9f8be6f5d449d645ce9b0199ee53a7e6728d19d2"
"checksumValue": "fb5ab81f27612b0a7b4861ba655906c76dc85ee969e7a4905d2075aff931e8d0"
}
],
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/sqlite-3.49.1.0.tar.gz",
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/sqlite-3.50.4.0.tar.gz",
"externalRefs": [
{
"referenceCategory": "SECURITY",
"referenceLocator": "cpe:2.3:a:sqlite:sqlite:3.49.1.0:*:*:*:*:*:*:*",
"referenceLocator": "cpe:2.3:a:sqlite:sqlite:3.50.4.0:*:*:*:*:*:*:*",
"referenceType": "cpe23Type"
}
],
"licenseConcluded": "NOASSERTION",
"name": "sqlite",
"primaryPackagePurpose": "SOURCE",
"versionInfo": "3.49.1.0"
"versionInfo": "3.50.4.0"
},
{
"SPDXID": "SPDXRef-PACKAGE-tcl-core",
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/get_externals.bat
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ set libraries=%libraries% bzip2-1.0.8
if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries% libffi-3.4.4
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-3.0.16
set libraries=%libraries% mpdecimal-4.0.0
set libraries=%libraries% sqlite-3.49.1.0
set libraries=%libraries% sqlite-3.50.4.0
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.15.0
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.15.0
set libraries=%libraries% xz-5.2.5
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/python.props
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<Import Project="$(ExternalProps)" Condition="$(ExternalProps) != '' and Exists('$(ExternalProps)')" />

<PropertyGroup>
<sqlite3Dir Condition="$(sqlite3Dir) == ''">$(ExternalsDir)sqlite-3.49.1.0\</sqlite3Dir>
<sqlite3Dir Condition="$(sqlite3Dir) == ''">$(ExternalsDir)sqlite-3.50.4.0\</sqlite3Dir>
<bz2Dir Condition="$(bz2Dir) == ''">$(ExternalsDir)bzip2-1.0.8\</bz2Dir>
<lzmaDir Condition="$(lzmaDir) == ''">$(ExternalsDir)xz-5.2.5\</lzmaDir>
<libffiDir Condition="$(libffiDir) == ''">$(ExternalsDir)libffi-3.4.4\</libffiDir>
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ _ssl
again when building.

_sqlite3
Wraps SQLite 3.49.1, which is itself built by sqlite3.vcxproj
Wraps SQLite 3.50.4, which is itself built by sqlite3.vcxproj
Homepage:
https://www.sqlite.org/

Expand Down
7 changes: 7 additions & 0 deletions Python/flowgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -3472,18 +3472,21 @@ convert_pseudo_conditional_jumps(cfg_builder *g)
instr->i_opcode = instr->i_opcode == JUMP_IF_FALSE ?
POP_JUMP_IF_FALSE : POP_JUMP_IF_TRUE;
location loc = instr->i_loc;
basicblock *except = instr->i_except;
cfg_instr copy = {
.i_opcode = COPY,
.i_oparg = 1,
.i_loc = loc,
.i_target = NULL,
.i_except = except,
};
RETURN_IF_ERROR(basicblock_insert_instruction(b, i++, &copy));
cfg_instr to_bool = {
.i_opcode = TO_BOOL,
.i_oparg = 0,
.i_loc = loc,
.i_target = NULL,
.i_except = except,
};
RETURN_IF_ERROR(basicblock_insert_instruction(b, i++, &to_bool));
}
Expand Down Expand Up @@ -3726,13 +3729,15 @@ insert_prefix_instructions(_PyCompile_CodeUnitMetadata *umd, basicblock *entrybl
.i_oparg = 0,
.i_loc = loc,
.i_target = NULL,
.i_except = NULL,
};
RETURN_IF_ERROR(basicblock_insert_instruction(entryblock, 0, &make_gen));
cfg_instr pop_top = {
.i_opcode = POP_TOP,
.i_oparg = 0,
.i_loc = loc,
.i_target = NULL,
.i_except = NULL,
};
RETURN_IF_ERROR(basicblock_insert_instruction(entryblock, 1, &pop_top));
}
Expand Down Expand Up @@ -3763,6 +3768,7 @@ insert_prefix_instructions(_PyCompile_CodeUnitMetadata *umd, basicblock *entrybl
.i_oparg = oldindex,
.i_loc = NO_LOCATION,
.i_target = NULL,
.i_except = NULL,
};
if (basicblock_insert_instruction(entryblock, ncellsused, &make_cell) < 0) {
PyMem_RawFree(sorted);
Expand All @@ -3779,6 +3785,7 @@ insert_prefix_instructions(_PyCompile_CodeUnitMetadata *umd, basicblock *entrybl
.i_oparg = nfreevars,
.i_loc = NO_LOCATION,
.i_target = NULL,
.i_except = NULL,
};
RETURN_IF_ERROR(basicblock_insert_instruction(entryblock, 0, &copy_frees));
}
Expand Down
Loading