8000 Merge branch 'main' of https://github.com/python/cpython into 131769-… · python/cpython@e7e3124 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7e3124

Browse files
committed
Merge branch 'main' of https://github.com/python/cpython into 131769-wasi-pydebug
2 parents e9c2822 + e5e51bd commit e7e3124

File tree

79 files changed

+2187
-712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2187
-712
lines changed

.github/workflows/jit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
114114
brew install llvm@${{ matrix.llvm }}
115115
export SDKROOT="$(xcrun --show-sdk-path)"
116-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
116+
./configure --enable-experimental-jit --enable-universalsdk --with-universal-archs=universal2 ${{ matrix.debug && '--with-pydebug' || '' }}
117117
make all --jobs 4
118118
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
119119

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Tools/unicode/data/
138138
# hendrikmuhs/ccache-action@v1
139139
/.ccache
140140
/cross-build/
141-
/jit_stencils.h
141+
/jit_stencils*.h
142142
/platform
143143
/profile-clean-stamp
144144
/profile-run-stamp

.ruff.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Default settings for Ruff in CPython
2+
3+
# PYTHON_FOR_REGEN
4+
target-version = "py310"
5+
6+
# PEP 8
7+
line-length = 79
8+
9+
# Enable automatic fixes by default.
10+
# To override this, use ``fix = false`` in a subdirectory's config file
11+
# or ``--no-fix`` on the command line.
12+
fix = true

Android/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ it:
2525
`android-sdk/cmdline-tools/latest`.
2626
* `export ANDROID_HOME=/path/to/android-sdk`
2727

28-
The `android.py` script also requires the following commands to be on the `PATH`:
28+
The `android.py` script will automatically use the SDK's `sdkmanager` to install
29+
any packages it needs.
30+
31+
The script also requires the following commands to be on the `PATH`:
2932

3033
* `curl`
3134
* `java` (or set the `JAVA_HOME` environment variable)
32-
* `tar`
3335

3436

3537
## Building
@@ -97,7 +99,7 @@ similar to the `Android` directory of the CPython source tree.
9799
The Python test suite can be run on Linux, macOS, or Windows:
98100

99101
* On Linux, the emulator needs access to the KVM virtualization interface, and
100-
a DISPLAY environment variable pointing at an X server.
102+
a DISPLAY environment variable pointing at an X server. Xvfb is acceptable.
101103

102104
The test suite can usually be run on a device with 2 GB of RAM, but this is
103105
borderline, so you may need to increase it to 4 GB. As of Android

Android/android.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,19 @@ def make_build_python(context):
138138
run(["make", "-j", str(os.cpu_count())])
139139

140140

141-
def unpack_deps(host):
141+
def unpack_deps(host, prefix_dir):
142142
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
143143
for name_ver in ["bzip2-1.0.8-2", "libffi-3.4.4-3", "openssl-3.0.15-4",
144144
"sqlite-3.49.1-0", "xz-5.4.6-1"]:
145145
filename = f"{name_ver}-{host}.tar.gz"
146146
download(f"{deps_url}/{name_ver}/{filename}")
147-
run(["tar", "-xf", filename])
147+
shutil.unpack_archive(filename, prefix_dir)
148148
os.remove(filename)
149149

150150

151151
def download(url, target_dir="."):
152152
out_path = f"{target_dir}/{basename(url)}"
153-
run(["curl", "-Lf", "-o", out_path, url])
153+
run(["curl" F438 , "-Lf", "--retry", "5", "--retry-all-errors", "-o", out_path, url])
154154
return out_path
155155

156156

@@ -162,8 +162,7 @@ def configure_host_python(context):
162162
prefix_dir = host_dir / "prefix"
163163
if not prefix_dir.exists():
164164
prefix_dir.mkdir()
165-
os.chdir(prefix_dir)
166-
unpack_deps(context.host)
165+
unpack_deps(context.host, prefix_dir)
167166

168167
os.chdir(host_dir)
169168
command = [
@@ -241,16 +240,15 @@ def setup_sdk():
241240
# the Gradle wrapper is not included in the CPython repository. Instead, we
242241
# extract it from the Gradle GitHub repository.
243242
def setup_testbed():
244-
# The Gradle version used for the build is specified in
245-
# testbed/gradle/wrapper/gradle-wrapper.properties. This wrapper version
246-
# doesn't need to match, as any version of the wrapper can download any
247-
# version of Gradle.
248-
version = "8.9.0"
249243
paths = ["gradlew", "gradlew.bat", "gradle/wrapper/gradle-wrapper.jar"]
250-
251244
if all((TESTBED_DIR / path).exists() for path in paths):
252245
return
253246

247+
# The wrapper version isn't important, as any version of the wrapper can
248+
# download any version of Gradle. The Gradle version actually used for the
249+
# build is specified in testbed/gradle/wrapper/gradle-wrapper.properties.
250+
version = "8.9.0"
251+
254252
for path in paths:
255253
out_path = TESTBED_DIR / path
256254
out_path.parent.mkdir(exist_ok=True)

Doc/.ruff.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
extend = "../.ruff.toml" # Inherit the project-wide settings
2+
13
target-version = "py312" # Align with the version in oldest_supported_sphinx
2-
fix = true
3-
output-format = "full"
4-
line-length = 79
54
extend-exclude = [
65
"includes/*",
76
# Temporary exclusions:

Doc/c-api/float.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ NaNs (if such things exist on the platform) isn't handled correctly, and
9696
attempting to unpack a bytes string containing an IEEE INF or NaN will raise an
9797
exception.
9898
99+
Note that NaNs type may not be preserved on IEEE platforms (silent NaN become
100+
quiet), for example on x86 systems in 32-bit mode.
101+
99102
On non-IEEE platforms with more precision, or larger dynamic range, than IEEE
100103
754 supports, not all values can be packed; on non-IEEE platforms with less
101104
precision, or smaller dynamic range, not all values can be unpacked. What

Doc/library/typing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ through a simple assignment::
665665
User-defined generics for parameter expressions are also supported via parameter
666666
specification variables in the form ``[**P]``. The behavior is consistent
667667
with type variables' described above as parameter specification variables are
668-
treated by the typing module as a specialized type variable. The one exception
668+
treated by the :mod:`!typing` module as a specialized type variable. The one exception
669669
to this is that a list of types can be used to substitute a :class:`ParamSpec`::
670670

671671
>>> class Z[T, **P]: ... # T is a TypeVar; P is a ParamSpec
@@ -706,7 +706,7 @@ are intended primarily for static type checking.
706706

707707
A user-defined generic class can have ABCs as base classes without a metaclass
708708
conflict. Generic metaclasses are not supported. The outcome of parameterizing
709-
generics is cached, and most types in the typing module are :term:`hashable` and
709+
generics is cached, and most types in the :mod:`!typing` module are :term:`hashable` and
710710
comparable for equality.
711711

712712

@@ -2787,7 +2787,7 @@ types.
27872787
Protocols
27882788
---------
27892789

2790-
The following protocols are provided by the typing module. All are decorated
2790+
The following protocols are provided by the :mod:`!typing` module. All are decorated
27912791
with :func:`@runtime_checkable <runtime_checkable>`.
27922792

27932793
.. class:: SupportsAbs
@@ -3531,7 +3531,7 @@ Deprecated aliases
35313531
------------------
35323532

35333533
This module defines several deprecated aliases to pre-existing
3534-
standard library classes. These were originally included in the typing
3534+
standard library classes. These were originally included in the :mod:`!typing`
35353535
module in order to support parameterizing these generic classes using ``[]``.
35363536
However, the aliases became redundant in Python 3.9 when the
35373537
corresponding pre-existing classes were enhanced to support ``[]`` (see
@@ -3544,7 +3544,7 @@ interpreter for these aliases.
35443544

35453545
If at some point it is decided to remove these deprecated aliases, a
35463546
deprecation warning will be issued by the interpreter for at least two releases
3547-
prior to removal. The aliases are guaranteed to remain in the typing module
3547+
prior to removal. The aliases are guaranteed to remain in the :mod:`!typing` module
35483548
without deprecation warnings until at least Python 3.14.
35493549

35503550
Type checkers are encouraged to flag uses of the deprecated types if the

Grammar/python.gram

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,12 @@ tstring_middle[expr_ty]:
971971
| tstring_replacement_field
972972
| t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
973973
tstring[expr_ty] (memo):
974-
| a=TSTRING_START b=tstring_middle* c=TSTRING_END { _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c) }
974+
| a=TSTRING_START b=tstring_middle* c=TSTRING_END {
975+
CHECK_VERSION(
976+
expr_ty,
977+
14,
978+
"t-strings are",
979+
_PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }
975980

976981
string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }
977982
strings[expr_ty] (memo): a[asdl_expr_seq*]=(fstring|string|tstring)+ { _PyPegen_concatenate_strings(p, a, EXTRA) }

Include/cpython/pystats.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
# error "this header file must not be included directly"
3030
#endif
3131

32-
#define PYSTATS_MAX_UOP_ID 512
32+
#define PYSTATS_MAX_UOP_ID 1024
3333

34-
#define SPECIALIZATION_FAILURE_KINDS 50
34+
#define SPECIALIZATION_FAILURE_KINDS 60
3535

3636
/* Stats for determining who is calling PyEval_EvalFrame */
3737
#define EVAL_CALL_TOTAL 0

Include/internal/pycore_crossinterp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ PyAPI_FUNC(_PyBytes_data_t *) _PyBytes_GetXIDataWrapped(
171171
xid_newobjfunc,
172172
_PyXIData_t *);
173173

174+
// _PyObject_GetXIData() for pickle
175+
PyAPI_DATA(PyObject *) _PyPickle_LoadFromXIData(_PyXIData_t *);
176+
PyAPI_FUNC(int) _PyPickle_GetXIData(
177+
PyThreadState *,
178+
PyObject *,
179+
_PyXIData_t *);
180+
174181
// _PyObject_GetXIData() for marshal
175182
PyAPI_FUNC(PyObject *) _PyMarshal_ReadObjectFromXIData(_PyXIData_t *);
176183
PyAPI_FUNC(int) _PyMarshal_GetXIData(

Include/internal/pycore_debug_offsets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extern "C" {
5959

6060

6161
typedef struct _Py_DebugOffsets {
62-
char cookie[8];
62+
char cookie[8] _Py_NONSTRING;
6363
uint64_t version;
6464
uint64_t free_threaded;
6565
// Runtime state offset;

Include/internal/pycore_list.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ extern "C" {
1313
#endif
1414

1515
PyAPI_FUNC(PyObject*) _PyList_Extend(PyListObject *, PyObject *);
16+
PyAPI_FUNC(PyObject) *_PyList_SliceSubscript(PyObject*, PyObject*);
1617
extern void _PyList_DebugMallocStats(FILE *out);
1718
// _PyList_GetItemRef should be used only when the object is known as a list
1819
// because it doesn't raise TypeError when the object is not a list, whereas PyList_GetItemRef does.
1920
extern PyObject* _PyList_GetItemRef(PyListObject *, Py_ssize_t i);
21+
22+
2023
#ifdef Py_GIL_DISABLED
2124
// Returns -1 in case of races with other threads.
2225
extern int _PyList_GetItemRefNoLock(PyListObject *, Py_ssize_t, _PyStackRef *);

Include/internal/pycore_opcode_metadata.h

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0