Skip to content

Commit 1c4f440

Browse files
committed
Merge branch 'main' into sys-jit
2 parents 775eb32 + a4be3bc commit 1c4f440

Some content is hidden

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

67 files changed

+889
-1201
lines changed

.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", "-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

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/funcobject.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ static inline PyObject* PyFunction_GET_GLOBALS(PyObject *func) {
9797
}
9898
#define PyFunction_GET_GLOBALS(func) PyFunction_GET_GLOBALS(_PyObject_CAST(func))
9999

100-
static inline PyObject* PyFunction_GET_BUILTINS(PyObject *func) {
101-
return _PyFunction_CAST(func)->func_builtins;
102-
}
103-
#define PyFunction_GET_BUILTINS(func) PyFunction_GET_BUILTINS(_PyObject_CAST(func))
104-
105100
static inline PyObject* PyFunction_GET_MODULE(PyObject *func) {
106101
return _PyFunction_CAST(func)->func_module;
107102
}

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_code.h

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -565,57 +565,6 @@ extern int _Py_ClearUnusedTLBC(PyInterpreterState *interp);
565565
#endif
566566

567567

568-
typedef struct {
569-
int total;
570-
struct co_locals_counts {
571-
int total;
572-
struct {
573-
int total;
574-
int numposonly;
575-
int numposorkw;
576-
int numkwonly;
577-
int varargs;
578-
int varkwargs;
579-
} args;
580-
int numpure;
581-
struct {
582-
int total;
583-
// numargs does not contribute to locals.total.
584-
int numargs;
585-
int numothers;
586-
} cells;
587-
struct {
588-
int total;
589-
int numpure;
590-
int numcells;
591-
} hidden;
592-
} locals;
593-
int numfree; // nonlocal
594-
struct co_unbound_counts {
595-
int total;
596-
struct {
597-
int total;
598-
int numglobal;
599-
int numbuiltin;
600-
int numunknown;
601-
} globals;
602-
int numattrs;
603-
int numunknown;
604-
} unbound;
605-
} _PyCode_var_counts_t;
606-
607-
PyAPI_FUNC(void) _PyCode_GetVarCounts(
608-
PyCodeObject *,
609-
_PyCode_var_counts_t *);
610-
PyAPI_FUNC(int) _PyCode_SetUnboundVarCounts(
611-
PyThreadState *,
612-
PyCodeObject *,
613-
_PyCode_var_counts_t *,
614-
PyObject *globalnames,
615-
PyObject *attrnames,
616-
PyObject *globalsns,
617-
PyObject *builtinsns);
618-
619568
PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);
620569

621570

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;

0 commit comments

Comments
 (0)