Skip to content

Commit a870fad

Browse files
committed
update to boost 1.78 and python 3.10.1
1 parent 566cd0a commit a870fad

File tree

423 files changed

+15041
-8933
lines changed

Some content is hidden

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

423 files changed

+15041
-8933
lines changed

PythonLib/full/__future__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
argument to the builtin function compile() to enable the feature in
4343
dynamically compiled code. This flag is stored in the .compiler_flag
4444
attribute on _Future instances. These values must match the appropriate
45-
#defines of CO_xxx flags in Include/compile.h.
45+
#defines of CO_xxx flags in Include/cpython/compile.h.
4646
4747
No feature line is ever to be deleted from this file.
4848
"""
@@ -143,5 +143,5 @@ def __repr__(self):
143143
CO_FUTURE_GENERATOR_STOP)
144144

145145
annotations = _Feature((3, 7, 0, "beta", 1),
146-
(3, 10, 0, "alpha", 0),
146+
(3, 11, 0, "alpha", 0),
147147
CO_FUTURE_ANNOTATIONS)

PythonLib/full/_aix_support.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ def _aix_tag(vrtl, bd):
1515
# type: (List[int], int) -> str
1616
# Infer the ABI bitwidth from maxsize (assuming 64 bit as the default)
1717
_sz = 32 if sys.maxsize == (2**31-1) else 64
18-
_bd = bd if bd != 0 else 9988
1918
# vrtl[version, release, technology_level]
20-
return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], _bd, _sz)
19+
return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], bd, _sz)
2120

2221

2322
# extract version, release and technology level from a VRMF string
@@ -27,20 +26,19 @@ def _aix_vrtl(vrmf):
2726
return [int(v[-1]), int(r), int(tl)]
2827

2928

30-
def _aix_bos_rte():
29+
def _aix_bosmp64():
3130
# type: () -> Tuple[str, int]
3231
"""
3332
Return a Tuple[str, int] e.g., ['7.1.4.34', 1806]
34-
The fileset bos.rte represents the current AIX run-time level. It's VRMF and
35-
builddate reflect the current ABI levels of the runtime environment.
36-
If no builddate is found give a value that will satisfy pep425 related queries
33+
The fileset bos.mp64 is the AIX kernel. It's VRMF and builddate
34+
reflect the current ABI levels of the runtime environment.
3735
"""
38-
# All AIX systems to have lslpp installed in this location
39-
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.rte"])
36+
# We expect all AIX systems to have lslpp installed in this location
37+
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.mp64"])
4038
out = out.decode("utf-8")
4139
out = out.strip().split(":") # type: ignore
42-
_bd = int(out[-1]) if out[-1] != '' else 9988
43-
return (str(out[2]), _bd)
40+
# Use str() and int() to help mypy see types
41+
return (str(out[2]), int(out[-1]))
4442

4543

4644
def aix_platform():
@@ -49,11 +47,11 @@ def aix_platform():
4947
AIX filesets are identified by four decimal values: V.R.M.F.
5048
V (version) and R (release) can be retreived using ``uname``
5149
Since 2007, starting with AIX 5.3 TL7, the M value has been
52-
included with the fileset bos.rte and represents the Technology
50+
included with the fileset bos.mp64 and represents the Technology
5351
Level (TL) of AIX. The F (Fix) value also increases, but is not
5452
relevant for comparing releases and binary compatibility.
5553
For binary compatibility the so-called builddate is needed.
56-
Again, the builddate of an AIX release is associated with bos.rte.
54+
Again, the builddate of an AIX release is associated with bos.mp64.
5755
AIX ABI compatibility is described as guaranteed at: https://www.ibm.com/\
5856
support/knowledgecenter/en/ssw_aix_72/install/binary_compatability.html
5957
@@ -62,7 +60,7 @@ def aix_platform():
6260
e.g., "aix-6107-1415-32" for AIX 6.1 TL7 bd 1415, 32-bit
6361
and, "aix-6107-1415-64" for AIX 6.1 TL7 bd 1415, 64-bit
6462
"""
65-
vrmf, bd = _aix_bos_rte()
63+
vrmf, bd = _aix_bosmp64()
6664
return _aix_tag(_aix_vrtl(vrmf), bd)
6765

6866

@@ -81,7 +79,7 @@ def aix_buildtag():
8179
Return the platform_tag of the system Python was built on.
8280
"""
8381
# AIX_BUILDDATE is defined by configure with:
84-
# lslpp -Lcq bos.rte | awk -F: '{ print $NF }'
82+
# lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }'
8583
build_date = sysconfig.get_config_var("AIX_BUILDDATE")
8684
try:
8785
build_date = int(build_date)

PythonLib/full/_bootlocale.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

PythonLib/full/_collections_abc.py

Lines changed: 97 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def __subclasshook__(cls, C):
416416
class _CallableGenericAlias(GenericAlias):
417417
""" Represent `Callable[argtypes, resulttype]`.
418418
419-
This sets ``__args__`` to a tuple containing the flattened``argtypes``
419+
This sets ``__args__`` to a tuple containing the flattened ``argtypes``
420420
followed by ``resulttype``.
421421
422422
Example: ``Callable[[int, str], float]`` sets ``__args__`` to
@@ -426,53 +426,107 @@ class _CallableGenericAlias(GenericAlias):
426426
__slots__ = ()
427427

428428
def __new__(cls, origin, args):
429-
try:
430-
return cls.__create_ga(origin, args)
431-
except TypeError as exc:
432-
import warnings
433-
warnings.warn(f'{str(exc)} '
434-
f'(This will raise a TypeError in Python 3.10.)',
435-
DeprecationWarning)
436-
return GenericAlias(origin, args)
437-
438-
@classmethod
439-
def __create_ga(cls, origin, args):
440-
if not isinstance(args, tuple) or len(args) != 2:
429+
if not (isinstance(args, tuple) and len(args) == 2):
441430
raise TypeError(
442431
"Callable must be used as Callable[[arg, ...], result].")
443432
t_args, t_result = args
444-
if isinstance(t_args, (list, tuple)):
445-
ga_args = tuple(t_args) + (t_result,)
446-
# This relaxes what t_args can be on purpose to allow things like
447-
# PEP 612 ParamSpec. Responsibility for whether a user is using
448-
# Callable[...] properly is deferred to static type checkers.
449-
else:
450-
ga_args = args
451-
return super().__new__(cls, origin, ga_args)
433+
if isinstance(t_args, list):
434+
args = (*t_args, t_result)
435+
elif not _is_param_expr(t_args):
436+
raise TypeError(f"Expected a list of types, an ellipsis, "
437+
f"ParamSpec, or Concatenate. Got {t_args}")
438+
return super().__new__(cls, origin, args)
439+
440+
@property
441+
def __parameters__(self):
442+
params = []
443+
for arg in self.__args__:
444+
# Looks like a genericalias
445+
if hasattr(arg, "__parameters__") and isinstance(arg.__parameters__, tuple):
446+
params.extend(arg.__parameters__)
447+
else:
448+
if _is_typevarlike(arg):
449+
params.append(arg)
450+
return tuple(dict.fromkeys(params))
452451

453452
def __repr__(self):
454-
if len(self.__args__) == 2 and self.__args__[0] is Ellipsis:
453+
if len(self.__args__) == 2 and _is_param_expr(self.__args__[0]):
455454
return super().__repr__()
456455
return (f'collections.abc.Callable'
457456
f'[[{", ".join([_type_repr(a) for a in self.__args__[:-1]])}], '
458457
f'{_type_repr(self.__args__[-1])}]')
459458

460459
def __reduce__(self):
461460
args = self.__args__
462-
if not (len(args) == 2 and args[0] is Ellipsis):
461+
if not (len(args) == 2 and _is_param_expr(args[0])):
463462
args = list(args[:-1]), args[-1]
464463
return _CallableGenericAlias, (Callable, args)
465464

466465
def __getitem__(self, item):
467466
# Called during TypeVar substitution, returns the custom subclass
468-
# rather than the default types.GenericAlias object.
469-
ga = super().__getitem__(item)
470-
args = ga.__args__
471-
t_result = args[-1]
472-
t_args = args[:-1]
473-
args = (t_args, t_result)
474-
return _CallableGenericAlias(Callable, args)
475-
467+
# rather than the default types.GenericAlias object. Most of the
468+
# code is copied from typing's _GenericAlias and the builtin
469+
# types.GenericAlias.
470+
471+
# A special case in PEP 612 where if X = Callable[P, int],
472+
# then X[int, str] == X[[int, str]].
473+
param_len = len(self.__parameters__)
474+
if param_len == 0:
475+
raise TypeError(f'{self} is not a generic class')
476+
if not isinstance(item, tuple):
477+
item = (item,)
478+
if (param_len == 1 and _is_param_expr(self.__parameters__[0])
479+
and item and not _is_param_expr(item[0])):
480+
item = (list(item),)
481+
item_len = len(item)
482+
if item_len != param_len:
483+
raise TypeError(f'Too {"many" if item_len > param_len else "few"}'
484+
f' arguments for {self};'
485+
f' actual {item_len}, expected {param_len}')
486+
subst = dict(zip(self.__parameters__, item))
487+
new_args = []
488+
for arg in self.__args__:
489+
if _is_typevarlike(arg):
490+
if _is_param_expr(arg):
491+
arg = subst[arg]
492+
if not _is_param_expr(arg):
493+
raise TypeError(f"Expected a list of types, an ellipsis, "
494+
f"ParamSpec, or Concatenate. Got {arg}")
495+
else:
496+
arg = subst[arg]
497+
# Looks like a GenericAlias
498+
elif hasattr(arg, '__parameters__') and isinstance(arg.__parameters__, tuple):
499+
subparams = arg.__parameters__
500+
if subparams:
501+
subargs = tuple(subst[x] for x in subparams)
502+
arg = arg[subargs]
503+
new_args.append(arg)
504+
505+
# args[0] occurs due to things like Z[[int, str, bool]] from PEP 612
506+
if not isinstance(new_args[0], list):
507+
t_result = new_args[-1]
508+
t_args = new_args[:-1]
509+
new_args = (t_args, t_result)
510+
return _CallableGenericAlias(Callable, tuple(new_args))
511+
512+
513+
def _is_typevarlike(arg):
514+
obj = type(arg)
515+
# looks like a TypeVar/ParamSpec
516+
return (obj.__module__ == 'typing'
517+
and obj.__name__ in {'ParamSpec', 'TypeVar'})
518+
519+
def _is_param_expr(obj):
520+
"""Checks if obj matches either a list of types, ``...``, ``ParamSpec`` or
521+
``_ConcatenateGenericAlias`` from typing.py
522+
"""
523+
if obj is Ellipsis:
524+
return True
525+
if isinstance(obj, list):
526+
return True
527+
obj = type(obj)
528+
names = ('ParamSpec', '_ConcatenateGenericAlias')
529+
return obj.__module__ == 'typing' and any(obj.__name__ == name for name in names)
476530

477531
def _type_repr(obj):
478532
"""Return the repr() of an object, special-casing types (internal helper).
@@ -514,7 +568,6 @@ def __subclasshook__(cls, C):
514568

515569

516570
class Set(Collection):
517-
518571
"""A set is a finite, iterable container.
519572
520573
This class provides concrete generic implementations of all
@@ -740,19 +793,19 @@ def __isub__(self, it):
740793

741794
### MAPPINGS ###
742795

743-
744796
class Mapping(Collection):
745-
746-
__slots__ = ()
747-
748797
"""A Mapping is a generic container for associating key/value
749798
pairs.
750799
751800
This class provides concrete generic implementations of all
752801
methods except for __getitem__, __iter__, and __len__.
753-
754802
"""
755803

804+
__slots__ = ()
805+
806+
# Tell ABCMeta.__new__ that this class should have TPFLAGS_MAPPING set.
807+
__abc_tpflags__ = 1 << 6 # Py_TPFLAGS_MAPPING
808+
756809
@abstractmethod
757810
def __getitem__(self, key):
758811
raise KeyError
@@ -791,7 +844,6 @@ def __eq__(self, other):
791844

792845
__reversed__ = None
793846

794-
795847
Mapping.register(mappingproxy)
796848

797849

@@ -874,18 +926,16 @@ def __iter__(self):
874926

875927

876928
class MutableMapping(Mapping):
877-
878-
__slots__ = ()
879-
880929
"""A MutableMapping is a generic container for associating
881930
key/value pairs.
882931
883932
This class provides concrete generic implementations of all
884933
methods except for __getitem__, __setitem__, __delitem__,
885934
__iter__, and __len__.
886-
887935
"""
888936

937+
__slots__ = ()
938+
889939
@abstractmethod
890940
def __setitem__(self, key, value):
891941
raise KeyError
@@ -962,9 +1012,7 @@ def setdefault(self, key, default=None):
9621012

9631013
### SEQUENCES ###
9641014

965-
9661015
class Sequence(Reversible, Collection):
967-
9681016
"""All the operations on a read-only sequence.
9691017
9701018
Concrete subclasses must override __new__ or __init__,
@@ -973,6 +1021,9 @@ class Sequence(Reversible, Collection):
9731021

9741022
__slots__ = ()
9751023

1024+
# Tell ABCMeta.__new__ that this class should have TPFLAGS_SEQUENCE set.
1025+
__abc_tpflags__ = 1 << 5 # Py_TPFLAGS_SEQUENCE
1026+
9761027
@abstractmethod
9771028
def __getitem__(self, index):
9781029
raise IndexError
@@ -1024,15 +1075,13 @@ def count(self, value):
10241075
'S.count(value) -> integer -- return number of occurrences of value'
10251076
return sum(1 for v in self if v is value or v == value)
10261077

1027-
10281078
Sequence.register(tuple)
10291079
Sequence.register(str)
10301080
Sequence.register(range)
10311081
Sequence.register(memoryview)
10321082

10331083

10341084
class ByteString(Sequence):
1035-
10361085
"""This unifies bytes and bytearray.
10371086
10381087
XXX Should add all their methods.
@@ -1045,16 +1094,14 @@ class ByteString(Sequence):
10451094

10461095

10471096
class MutableSequence(Sequence):
1048-
1049-
__slots__ = ()
1050-
10511097
"""All the operations on a read-write sequence.
10521098
10531099
Concrete subclasses must provide __new__ or __init__,
10541100
__getitem__, __setitem__, __delitem__, __len__, and insert().
1055-
10561101
"""
10571102

1103+
__slots__ = ()
1104+
10581105
@abstractmethod
10591106
def __setitem__(self, index, value):
10601107
raise IndexError

0 commit comments

Comments
 (0)