Skip to content

Commit 0bf8598

Browse files
committed
Merge branch '3.12' into backport-c-recursion-changes
2 parents acaf0d5 + 5fb2204 commit 0bf8598

File tree

13 files changed

+3487
-61
lines changed

13 files changed

+3487
-61
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Lib/keyword.py generated
8080
Lib/test/levenshtein_examples.json generated
8181
Lib/test/test_stable_abi_ctypes.py generated
8282
Lib/token.py generated
83+
Misc/sbom.spdx.json generated
8384
Objects/typeslots.inc generated
8485
PC/python3dll.c generated
8586
Parser/parser.c generated

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,7 @@ Lib/ast.py @isidentical
166166

167167
# zipfile.Path
168168
**/*zipfile/_path/* @jaraco
169+
170+
# SBOM
171+
/Misc/sbom.spdx.json @sethmlarson
172+
/Tools/build/generate_sbom.py @sethmlarson

Doc/license.rst

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,29 +1045,32 @@ https://www.w3.org/TR/xml-c14n2-testcases/ and is distributed under the
10451045
Audioop
10461046
-------
10471047

1048-
The audioop module uses the code base in g771.c file of the SoX project::
1049-
1050-
Programming the AdLib/Sound Blaster
1051-
FM Music Chips
1052-
Version 2.0 (24 Feb 1992)
1053-
Copyright (c) 1991, 1992 by Jeffrey S. Lee
1054-
1055-
Warranty and Copyright Policy
1056-
This document is provided on an "as-is" basis, and its author makes
1057-
no warranty or representation, express or implied, with respect to
1058-
its quality performance or fitness for a particular purpose. In no
1059-
event will the author of this document be liable for direct, indirect,
1060-
special, incidental, or consequential damages arising out of the use
1061-
or inability to use the information contained within. Use of this
1062-
document is at your own risk.
1063-
This file may be used and copied freely so long as the applicable
1064-
copyright notices are retained, and no modifications are made to the
1065-
text of the document. No money shall be charged for its distribution
1066-
beyond reasonable shipping, handling and duplication costs, nor shall
1067-
proprietary changes be made to this document so that it cannot be
1068-
distributed freely. This document may not be included in published
1069-
material or commercial packages without the written consent of its
1070-
author.
1048+
The audioop module uses the code base in g771.c file of the SoX project.
1049+
https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz
1050+
1051+
This source code is a product of Sun Microsystems, Inc. and is provided
1052+
for unrestricted use. Users may copy or modify this source code without
1053+
charge.
1054+
1055+
SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
1056+
THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1057+
PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
1058+
1059+
Sun source code is provided with no support and without any obligation on
1060+
the part of Sun Microsystems, Inc. to assist in its use, correction,
1061+
modification or enhancement.
1062+
1063+
SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
1064+
INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
1065+
OR ANY PART THEREOF.
1066+
1067+
In no event will Sun Microsystems, Inc. be liable for any lost revenue
1068+
or profits or other special, indirect and consequential damages, even if
1069+
Sun has been advised of the possibility of such damages.
1070+
1071+
Sun Microsystems, Inc.
1072+
2550 Garcia Avenue
1073+
Mountain View, California 94043
10711074

10721075

10731076
asyncio

Lib/test/test_zoneinfo/test_zoneinfo.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from test.support import MISSING_C_DOCSTRINGS
2121
from test.test_zoneinfo import _support as test_support
2222
from test.test_zoneinfo._support import OS_ENV_LOCK, TZPATH_TEST_LOCK, ZoneInfoTestBase
23-
from test.support.import_helper import import_module
23+
from test.support.import_helper import import_module, CleanImport
2424

2525
lzma = import_module('lzma')
2626
py_zoneinfo, c_zoneinfo = test_support.get_modules()
@@ -1719,13 +1719,26 @@ def test_env_variable_relative_paths(self):
17191719
with self.subTest("warning", path_var=path_var):
17201720
# Note: Per PEP 615 the warning is implementation-defined
17211721
# behavior, other implementations need not warn.
1722-
with self.assertWarns(self.module.InvalidTZPathWarning):
1722+
with self.assertWarns(self.module.InvalidTZPathWarning) as w:
17231723
self.module.reset_tzpath()
1724+
self.assertEqual(w.warnings[0].filename, __file__)
17241725

17251726
tzpath = self.module.TZPATH
17261727
with self.subTest("filtered", path_var=path_var):
17271728
self.assertSequenceEqual(tzpath, expected_paths)
17281729

1730+
def test_env_variable_relative_paths_warning_location(self):
1731+
path_var = "path/to/somewhere"
1732+
1733+
with self.python_tzpath_context(path_var):
1734+
with CleanImport("zoneinfo", "zoneinfo._tzpath"):
1735+
with self.assertWarns(RuntimeWarning) as w:
1736+
import zoneinfo
1737+
InvalidTZPathWarning = zoneinfo.InvalidTZPathWarning
1738+
self.assertIsInstance(w.warnings[0].message, InvalidTZPathWarning)
1739+
# It should represent the current file:
1740+
self.assertEqual(w.warnings[0].filename, __file__)
1741+
17291742
def test_reset_tzpath_kwarg(self):
17301743
self.module.reset_tzpath(to=["/a/b/c"])
17311744

Lib/zoneinfo/_tzpath.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sysconfig
33

44

5-
def reset_tzpath(to=None):
5+
def _reset_tzpath(to=None, stacklevel=4):
66
global TZPATH
77

88
tzpaths = to
@@ -18,17 +18,22 @@ def reset_tzpath(to=None):
1818
base_tzpath = tzpaths
1919
else:
2020
env_var = os.environ.get("PYTHONTZPATH", None)
21-
if env_var is not None:
22-
base_tzpath = _parse_python_tzpath(env_var)
23-
else:
24-
base_tzpath = _parse_python_tzpath(
25-
sysconfig.get_config_var("TZPATH")
26-
)
21+
if env_var is None:
22+
env_var = sysconfig.get_config_var("TZPATH")
23+
base_tzpath = _parse_python_tzpath(env_var, stacklevel)
2724

2825
TZPATH = tuple(base_tzpath)
2926

3027

31-
def _parse_python_tzpath(env_var):
28+
def reset_tzpath(to=None):
29+
"""Reset global TZPATH."""
30+
# We need `_reset_tzpath` helper function because it produces a warning,
31+
# it is used as both a module-level call and a public API.
32+
# This is how we equalize the stacklevel for both calls.
33+
_reset_tzpath(to)
34+
35+
36+
def _parse_python_tzpath(env_var, stacklevel):
3237
if not env_var:
3338
return ()
3439

@@ -45,6 +50,7 @@ def _parse_python_tzpath(env_var):
4550
"Invalid paths specified in PYTHONTZPATH environment variable. "
4651
+ msg,
4752
InvalidTZPathWarning,
53+
stacklevel=stacklevel,
4854
)
4955

5056
return new_tzpath
@@ -172,4 +178,4 @@ class InvalidTZPathWarning(RuntimeWarning):
172178

173179

174180
TZPATH = ()
175-
reset_tzpath()
181+
_reset_tzpath(stacklevel=5)

Makefile.pre.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ regen-limited-abi: all
13201320
regen-all: regen-cases regen-opcode regen-opcode-targets regen-typeslots \
13211321
regen-token regen-ast regen-keyword regen-sre regen-frozen \
13221322
regen-pegen-metaparser regen-pegen regen-test-frozenmain \
1323-
regen-test-levenshtein regen-global-objects
1323+
regen-test-levenshtein regen-global-objects regen-sbom
13241324
@echo
13251325
@echo "Note: make regen-stdlib-module-names and make regen-configure should be run manually"
13261326

@@ -2605,6 +2605,10 @@ autoconf:
26052605
regen-configure:
26062606
$(srcdir)/Tools/build/regen-configure.sh
26072607

2608+
.PHONY: regen-sbom
2609+
regen-sbom:
2610+
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/build/generate_sbom.py
2611+
26082612
# Create a tags file for vi
26092613
tags::
26102614
ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/cpython/*.h $(srcdir)/Include/internal/*.h
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix stacklevel in ``InvalidTZPathWarning`` during :mod:`zoneinfo` module
2+
import.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update Windows builds to use zlib v1.3.1.

0 commit comments

Comments
 (0)