Skip to content

Commit 12dfb8a

Browse files
authored
Merge branch 'main' into enable-wasm-dynamic-linking
2 parents cc1779b + d49e6f3 commit 12dfb8a

Some content is hidden

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

45 files changed

+2329
-273
lines changed

Android/android.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ANDROID_DIR.name == "Android" and (PYTHON_DIR / "pyconfig.h.in").exists()
3030
)
3131

32+
ENV_SCRIPT = ANDROID_DIR / "android-env.sh"
3233
TESTBED_DIR = ANDROID_DIR / "testbed"
3334
CROSS_BUILD_DIR = PYTHON_DIR / "cross-build"
3435

@@ -129,12 +130,11 @@ def android_env(host):
129130
sysconfig_filename = next(sysconfig_files).name
130131
host = re.fullmatch(r"_sysconfigdata__android_(.+).py", sysconfig_filename)[1]
131132

132-
env_script = ANDROID_DIR / "android-env.sh"
133133
env_output = subprocess.run(
134134
f"set -eu; "
135135
f"HOST={host}; "
136136
f"PREFIX={prefix}; "
137-
f". {env_script}; "
137+
f". {ENV_SCRIPT}; "
138138
f"export",
139139
check=True, shell=True, capture_output=True, encoding='utf-8',
140140
).stdout
@@ -151,7 +151,7 @@ def android_env(host):
151151
env[key] = value
152152

153153
if not env:
154-
raise ValueError(f"Found no variables in {env_script.name} output:\n"
154+
raise ValueError(f"Found no variables in {ENV_SCRIPT.name} output:\n"
155155
+ env_output)
156156
return env
157157

@@ -281,15 +281,30 @@ def clean_all(context):
281281

282282

283283
def setup_ci():
284-
# https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
285-
if "GITHUB_ACTIONS" in os.environ and platform.system() == "Linux":
286-
run(
287-
["sudo", "tee", "/etc/udev/rules.d/99-kvm4all.rules"],
288-
input='KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n',
289-
text=True,
290-
)
291-
run(["sudo", "udevadm", "control", "--reload-rules"])
292-
run(["sudo", "udevadm", "trigger", "--name-match=kvm"])
284+
if "GITHUB_ACTIONS" in os.environ:
285+
# Enable emulator hardware acceleration
286+
# (https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/).
287+
if platform.system() == "Linux":
288+
run(
289+
["sudo", "tee", "/etc/udev/rules.d/99-kvm4all.rules"],
290+
input='KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n',
291+
text=True,
292+
)
293+
run(["sudo", "udevadm", "control", "--reload-rules"])
294+
run(["sudo", "udevadm", "trigger", "--name-match=kvm"])
295+
296+
# Free up disk space by deleting unused versions of the NDK
297+
# (https://github.com/freakboy3742/pyspamsum/pull/108).
298+
for line in ENV_SCRIPT.read_text().splitlines():
299+
if match := re.fullmatch(r"ndk_version=(.+)", line):
300+
ndk_version = match[1]
301+
break
302+
else:
303+
raise ValueError(f"Failed to find NDK version in {ENV_SCRIPT.name}")
304+
305+
for item in (android_home / "ndk").iterdir():
306+
if item.name[0].isdigit() and item.name != ndk_version:
307+
delete_glob(item)
293308

294309

295310
def setup_sdk():

Android/testbed/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ android {
7979
val androidEnvFile = file("../../android-env.sh").absoluteFile
8080

8181
namespace = "org.python.testbed"
82-
compileSdk = 34
82+
compileSdk = 35
8383

8484
defaultConfig {
8585
applicationId = "org.python.testbed"
@@ -92,7 +92,7 @@ android {
9292
}
9393
throw GradleException("Failed to find API level in $androidEnvFile")
9494
}
95-
targetSdk = 34
95+
targetSdk = 35
9696

9797
versionCode = 1
9898
versionName = "1.0"

Doc/c-api/set.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
147147
148148
Return ``1`` if found and removed, ``0`` if not found (no action taken), and ``-1`` if an
149149
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
150-
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~frozenset.discard`
150+
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
151151
method, this function does not automatically convert unhashable sets into
152152
temporary frozensets. Raise :exc:`SystemError` if *set* is not an
153153
instance of :class:`set` or its subtype.

Doc/library/readline.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ Startup hooks
246246
if Python was compiled for a version of the library that supports it.
247247

248248

249+
.. function:: get_pre_input_hook()
250+
251+
Get the current pre-input hook function, or ``None`` if no pre-input hook
252+
function has been set. This function only exists if Python was compiled
253+
for a version of the library that supports it.
254+
255+
.. versionadded:: next
256+
257+
249258
.. _readline-completion:
250259

251260
Completion

Doc/library/stdtypes.rst

Lines changed: 109 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -4826,7 +4826,7 @@ other sequence-like behavior.
48264826

48274827
There are currently two built-in set types, :class:`set` and :class:`frozenset`.
48284828
The :class:`set` type is mutable --- the contents can be changed using methods
4829-
like :meth:`add <frozenset.add>` and :meth:`remove <frozenset.add>`.
4829+
like :meth:`~set.add` and :meth:`~set.remove`.
48304830
Since it is mutable, it has no hash value and cannot be used as
48314831
either a dictionary key or as an element of another set.
48324832
The :class:`frozenset` type is immutable and :term:`hashable` ---
@@ -4848,164 +4848,172 @@ The constructors for both classes work the same:
48484848
objects. If *iterable* is not specified, a new empty set is
48494849
returned.
48504850

4851-
Sets can be created by several means:
4851+
Sets can be created by several means:
48524852

4853-
* Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``
4854-
* Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``
4855-
* Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', 'foo'])``
4853+
* Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``
4854+
* Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``
4855+
* Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', 'foo'])``
48564856

4857-
Instances of :class:`set` and :class:`frozenset` provide the following
4858-
operations:
4857+
Instances of :class:`set` and :class:`frozenset` provide the following
4858+
operations:
48594859

4860-
.. describe:: len(s)
4860+
.. describe:: len(s)
48614861

4862-
Return the number of elements in set *s* (cardinality of *s*).
4862+
Return the number of elements in set *s* (cardinality of *s*).
48634863

4864-
.. describe:: x in s
4864+
.. describe:: x in s
48654865

4866-
Test *x* for membership in *s*.
4866+
Test *x* for membership in *s*.
48674867

4868-
.. describe:: x not in s
4868+
.. describe:: x not in s
48694869

4870-
Test *x* for non-membership in *s*.
4870+
Test *x* for non-membership in *s*.
48714871

4872-
.. method:: isdisjoint(other, /)
4872+
.. method:: frozenset.isdisjoint(other, /)
4873+
set.isdisjoint(other, /)
48734874

4874-
Return ``True`` if the set has no elements in common with *other*. Sets are
4875-
disjoint if and only if their intersection is the empty set.
4875+
Return ``True`` if the set has no elements in common with *other*. Sets are
4876+
disjoint if and only if their intersection is the empty set.
48764877

4877-
.. method:: issubset(other, /)
4878-
set <= other
4878+
.. method:: frozenset.issubset(other, /)
4879+
set.issubset(other, /)
4880+
.. describe:: set <= other
48794881

4880-
Test whether every element in the set is in *other*.
4882+
Test whether every element in the set is in *other*.
48814883

4882-
.. method:: set < other
4884+
.. describe:: set < other
48834885

4884-
Test whether the set is a proper subset of *other*, that is,
4885-
``set <= other and set != other``.
4886+
Test whether the set is a proper subset of *other*, that is,
4887+
``set <= other and set != other``.
48864888

4887-
.. method:: issuperset(other, /)
4888-
set >= other
4889+
.. method:: frozenset.issuperset(other, /)
4890+
set.issuperset(other, /)
4891+
.. describe:: set >= other
48894892

4890-
Test whether every element in *other* is in the set.
4893+
Test whether every element in *other* is in the set.
48914894

4892-
.. method:: set > other
4895+
.. describe:: set > other
48934896

4894-
Test whether the set is a proper superset of *other*, that is, ``set >=
4895-
other and set != other``.
4897+
Test whether the set is a proper superset of *other*, that is, ``set >=
4898+
other and set != other``.
48964899

4897-
.. method:: union(*others)
4898-
set | other | ...
4900+
.. method:: frozenset.union(*others)
4901+
set.union(*others)
4902+
.. describe:: set | other | ...
48994903
4900-
Return a new set with elements from the set and all others.
4904+
Return a new set with elements from the set and all others.
49014905

4902-
.. method:: intersection(*others)
4903-
set & other & ...
4906+
.. method:: frozenset.intersection(*others)
4907+
set.intersection(*others)
4908+
.. describe:: set & other & ...
49044909
4905-
Return a new set with elements common to the set and all others.
4910+
Return a new set with elements common to the set and all others.
49064911

4907-
.. method:: difference(*others)
4908-
set - other - ...
4912+
.. method:: frozenset.difference(*others)
4913+
set.difference(*others)
4914+
.. describe:: set - other - ...
49094915
4910-
Return a new set with elements in the set that are not in the others.
4916+
Return a new set with elements in the set that are not in the others.
49114917

4912-
.. method:: symmetric_difference(other, /)
4913-
set ^ other
4918+
.. method:: frozenset.symmetric_difference(other, /)
4919+
set.symmetric_difference(other, /)
4920+
.. describe:: set ^ other
49144921

4915-
Return a new set with elements in either the set or *other* but not both.
4922+
Return a new set with elements in either the set or *other* but not both.
49164923

4917-
.. method:: copy()
4924+
.. method:: frozenset.copy()
4925+
set.copy()
49184926

4919-
Return a shallow copy of the set.
4927+
Return a shallow copy of the set.
49204928

49214929

4922-
Note, the non-operator versions of :meth:`union`, :meth:`intersection`,
4923-
:meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and
4924-
:meth:`issuperset` methods will accept any iterable as an argument. In
4925-
contrast, their operator based counterparts require their arguments to be
4926-
sets. This precludes error-prone constructions like ``set('abc') & 'cbs'``
4927-
in favor of the more readable ``set('abc').intersection('cbs')``.
4930+
Note, the non-operator versions of :meth:`~frozenset.union`,
4931+
:meth:`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset.symmetric_difference`, :meth:`~frozenset.issubset`, and
4932+
:meth:`~frozenset.issuperset` methods will accept any iterable as an argument. In
4933+
contrast, their operator based counterparts require their arguments to be
4934+
sets. This precludes error-prone constructions like ``set('abc') & 'cbs'``
4935+
in favor of the more readable ``set('abc').intersection('cbs')``.
49284936

4929-
Both :class:`set` and :class:`frozenset` support set to set comparisons. Two
4930-
sets are equal if and only if every element of each set is contained in the
4931-
other (each is a subset of the other). A set is less than another set if and
4932-
only if the first set is a proper subset of the second set (is a subset, but
4933-
is not equal). A set is greater than another set if and only if the first set
4934-
is a proper superset of the second set (is a superset, but is not equal).
4937+
Both :class:`set` and :class:`frozenset` support set to set comparisons. Two
4938+
sets are equal if and only if every element of each set is contained in the
4939+
other (each is a subset of the other). A set is less than another set if and
4940+
only if the first set is a proper subset of the second set (is a subset, but
4941+
is not equal). A set is greater than another set if and only if the first set
4942+
is a proper superset of the second set (is a superset, but is not equal).
49354943

4936-
Instances of :class:`set` are compared to instances of :class:`frozenset`
4937-
based on their members. For example, ``set('abc') == frozenset('abc')``
4938-
returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``.
4944+
Instances of :class:`set` are compared to instances of :class:`frozenset`
4945+
based on their members. For example, ``set('abc') == frozenset('abc')``
4946+
returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``.
49394947

4940-
The subset and equality comparisons do not generalize to a total ordering
4941-
function. For example, any two nonempty disjoint sets are not equal and are not
4942-
subsets of each other, so *all* of the following return ``False``: ``a<b``,
4943-
``a==b``, or ``a>b``.
4948+
The subset and equality comparisons do not generalize to a total ordering
4949+
function. For example, any two nonempty disjoint sets are not equal and are not
4950+
subsets of each other, so *all* of the following return ``False``: ``a<b``,
4951+
``a==b``, or ``a>b``.
49444952

4945-
Since sets only define partial ordering (subset relationships), the output of
4946-
the :meth:`list.sort` method is undefined for lists of sets.
4953+
Since sets only define partial ordering (subset relationships), the output of
4954+
the :meth:`list.sort` method is undefined for lists of sets.
49474955

4948-
Set elements, like dictionary keys, must be :term:`hashable`.
4956+
Set elements, like dictionary keys, must be :term:`hashable`.
49494957

4950-
Binary operations that mix :class:`set` instances with :class:`frozenset`
4951-
return the type of the first operand. For example: ``frozenset('ab') |
4952-
set('bc')`` returns an instance of :class:`frozenset`.
4958+
Binary operations that mix :class:`set` instances with :class:`frozenset`
4959+
return the type of the first operand. For example: ``frozenset('ab') |
4960+
set('bc')`` returns an instance of :class:`frozenset`.
49534961

4954-
The following table lists operations available for :class:`set` that do not
4955-
apply to immutable instances of :class:`frozenset`:
4962+
The following table lists operations available for :class:`set` that do not
4963+
apply to immutable instances of :class:`frozenset`:
49564964

4957-
.. method:: update(*others)
4958-
set |= other | ...
4965+
.. method:: set.update(*others)
4966+
.. describe:: set |= other | ...
49594967

4960-
Update the set, adding elements from all others.
4968+
Update the set, adding elements from all others.
49614969

4962-
.. method:: intersection_update(*others)
4963-
set &= other & ...
4970+
.. method:: set.intersection_update(*others)
4971+
.. describe:: set &= other & ...
49644972

4965-
Update the set, keeping only elements found in it and all others.
4973+
Update the set, keeping only elements found in it and all others.
49664974

4967-
.. method:: difference_update(*others)
4968-
set -= other | ...
4975+
.. method:: set.difference_update(*others)
4976+
.. describe:: set -= other | ...
49694977

4970-
Update the set, removing elements found in others.
4978+
Update the set, removing elements found in others.
49714979

4972-
.. method:: symmetric_difference_update(other, /)
4973-
set ^= other
4980+
.. method:: set.symmetric_difference_update(other, /)
4981+
.. describe:: set ^= other
49744982

4975-
Update the set, keeping only elements found in either set, but not in both.
4983+
Update the set, keeping only elements found in either set, but not in both.
49764984

4977-
.. method:: add(elem, /)
4985+
.. method:: set.add(elem, /)
49784986

4979-
Add element *elem* to the set.
4987+
Add element *elem* to the set.
49804988

4981-
.. method:: remove(elem, /)
4989+
.. method:: set.remove(elem, /)
49824990

4983-
Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is
4984-
not contained in the set.
4991+
Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is
4992+
not contained in the set.
49854993

4986-
.. method:: discard(elem, /)
4994+
.. method:: set.discard(elem, /)
49874995

4988-
Remove element *elem* from the set if it is present.
4996+
Remove element *elem* from the set if it is present.
49894997

4990-
.. method:: pop()
4998+
.. method:: set.pop()
49914999

4992-
Remove and return an arbitrary element from the set. Raises
4993-
:exc:`KeyError` if the set is empty.
5000+
Remove and return an arbitrary element from the set. Raises
5001+
:exc:`KeyError` if the set is empty.
49945002

4995-
.. method:: clear()
5003+
.. method:: set.clear()
49965004

4997-
Remove all elements from the set.
5005+
Remove all elements from the set.
49985006

49995007

5000-
Note, the non-operator versions of the :meth:`update`,
5001-
:meth:`intersection_update`, :meth:`difference_update`, and
5002-
:meth:`symmetric_difference_update` methods will accept any iterable as an
5003-
argument.
5008+
Note, the non-operator versions of the :meth:`~set.update`,
5009+
:meth:`~set.intersection_update`, :meth:`~set.difference_update`, and
5010+
:meth:`~set.symmetric_difference_update` methods will accept any iterable as an
5011+
argument.
50045012

5005-
Note, the *elem* argument to the :meth:`~object.__contains__`,
5006-
:meth:`remove`, and
5007-
:meth:`discard` methods may be a set. To support searching for an equivalent
5008-
frozenset, a temporary one is created from *elem*.
5013+
Note, the *elem* argument to the :meth:`~object.__contains__`,
5014+
:meth:`~set.remove`, and
5015+
:meth:`~set.discard` methods may be a set. To support searching for an equivalent
5016+
frozenset, a temporary one is created from *elem*.
50095017

50105018

50115019
.. _typesmapping:

0 commit comments

Comments
 (0)