Skip to content

Commit c5134ed

Browse files
committed
Update Python inlined files: 3.8.2
1 parent 8887d67 commit c5134ed

File tree

109 files changed

+2115
-620
lines changed

Some content is hidden

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

109 files changed

+2115
-620
lines changed

graalpython/com.oracle.graal.python.cext/include/patchlevel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
/*--start constants--*/
1919
#define PY_MAJOR_VERSION 3
2020
#define PY_MINOR_VERSION 8
21-
#define PY_MICRO_VERSION 1
21+
#define PY_MICRO_VERSION 2
2222
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
2323
#define PY_RELEASE_SERIAL 0
2424

2525
/* Version as a string */
26-
#define PY_VERSION "3.8.1"
26+
#define PY_VERSION "3.8.2"
2727
/*--end constants--*/
2828

2929
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.

graalpython/com.oracle.graal.python.cext/modules/_memoryview.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
/* Memoryview object implementation */
1+
/*
2+
* Memoryview object implementation
3+
* --------------------------------
4+
*
5+
* This implementation is a complete rewrite contributed by Stefan Krah in
6+
* Python 3.3. Substantial credit goes to Antoine Pitrou (who had already
7+
* fortified and rewritten the previous implementation) and Nick Coghlan
8+
* (who came up with the idea of the ManagedBuffer) for analyzing the complex
9+
* ownership rules.
10+
*
11+
*/
212

313
#include "Python.h"
414
#include "pycore_object.h"
@@ -1681,8 +1691,8 @@ unpack_single(const char *ptr, const char *fmt)
16811691
switch (fmt[0]) {
16821692

16831693
/* signed integers and fast path for 'B' */
1684-
case 'B': uc = *((unsigned char *)ptr); goto convert_uc;
1685-
case 'b': ld = *((signed char *)ptr); goto convert_ld;
1694+
case 'B': uc = *((const unsigned char *)ptr); goto convert_uc;
1695+
case 'b': ld = *((const signed char *)ptr); goto convert_ld;
16861696
case 'h': UNPACK_SINGLE(ld, ptr, short); goto convert_ld;
16871697
case 'i': UNPACK_SINGLE(ld, ptr, int); goto convert_ld;
16881698
case 'l': UNPACK_SINGLE(ld, ptr, long); goto convert_ld;
@@ -2683,8 +2693,8 @@ unpack_cmp(const char *p, const char *q, char fmt,
26832693
switch (fmt) {
26842694

26852695
/* signed integers and fast path for 'B' */
2686-
case 'B': return *((unsigned char *)p) == *((unsigned char *)q);
2687-
case 'b': return *((signed char *)p) == *((signed char *)q);
2696+
case 'B': return *((const unsigned char *)p) == *((const unsigned char *)q);
2697+
case 'b': return *((const signed char *)p) == *((const signed char *)q);
26882698
case 'h': CMP_SINGLE(p, q, short); return equal;
26892699
case 'i': CMP_SINGLE(p, q, int); return equal;
26902700
case 'l': CMP_SINGLE(p, q, long); return equal;

graalpython/com.oracle.graal.python.cext/src/complexobject.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -743,29 +743,9 @@ complex__format__(PyObject* self, PyObject* args)
743743
return _PyUnicodeWriter_Finish(&writer);
744744
}
745745

746-
#if 0
747-
static PyObject *
748-
complex_is_finite(PyObject *self)
749-
{
750-
Py_complex c;
751-
c = ((PyComplexObject *)self)->cval;
752-
return PyBool_FromLong((long)(Py_IS_FINITE(c.real) &&
753-
Py_IS_FINITE(c.imag)));
754-
}
755-
756-
PyDoc_STRVAR(complex_is_finite_doc,
757-
"complex.is_finite() -> bool\n"
758-
"\n"
759-
"Returns True if the real and the imaginary part is finite.");
760-
#endif
761-
762746
static PyMethodDef complex_methods[] = {
763747
{"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS,
764748
complex_conjugate_doc},
765-
#if 0
766-
{"is_finite", (PyCFunction)complex_is_finite, METH_NOARGS,
767-
complex_is_finite_doc},
768-
#endif
769749
{"__getnewargs__", (PyCFunction)complex_getnewargs, METH_NOARGS},
770750
{"__format__", (PyCFunction)complex__format__,
771751
METH_VARARGS, complex__format__doc},

graalpython/com.oracle.graal.python.cext/src/floatobject.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -861,35 +861,6 @@ float_is_integer_impl(PyObject *self)
861861
return o;
862862
}
863863

864-
#if 0
865-
static PyObject *
866-
float_is_inf(PyObject *v)
867-
{
868-
double x = PyFloat_AsDouble(v);
869-
if (x == -1.0 && PyErr_Occurred())
870-
return NULL;
871-
return PyBool_FromLong((long)Py_IS_INFINITY(x));
872-
}
873-
874-
static PyObject *
875-
float_is_nan(PyObject *v)
876-
{
877-
double x = PyFloat_AsDouble(v);
878-
if (x == -1.0 && PyErr_Occurred())
879-
return NULL;
880-
return PyBool_FromLong((long)Py_IS_NAN(x));
881-
}
882-
883-
static PyObject *
884-
float_is_finite(PyObject *v)
885-
{
886-
double x = PyFloat_AsDouble(v);
887-
if (x == -1.0 && PyErr_Occurred())
888-
return NULL;
889-
return PyBool_FromLong((long)Py_IS_FINITE(x));
890-
}
891-
#endif
892-
893864
/*[clinic input]
894865
float.__trunc__
895866
@@ -1852,14 +1823,6 @@ static PyMethodDef float_methods[] = {
18521823
FLOAT_FROMHEX_METHODDEF
18531824
FLOAT_HEX_METHODDEF
18541825
FLOAT_IS_INTEGER_METHODDEF
1855-
#if 0
1856-
{"is_inf", (PyCFunction)float_is_inf, METH_NOARGS,
1857-
"Return True if the float is positive or negative infinite."},
1858-
{"is_finite", (PyCFunction)float_is_finite, METH_NOARGS,
1859-
"Return True if the float is finite, neither infinite nor NaN."},
1860-
{"is_nan", (PyCFunction)float_is_nan, METH_NOARGS,
1861-
"Return True if the float is not a number (NaN)."},
1862-
#endif
18631826
FLOAT___GETNEWARGS___METHODDEF
18641827
FLOAT___GETFORMAT___METHODDEF
18651828
FLOAT___SET_FORMAT___METHODDEF

graalpython/lib-python/3/argparse.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,24 +2144,23 @@ def _parse_optional(self, arg_string):
21442144
action = self._option_string_actions[option_string]
21452145
return action, option_string, explicit_arg
21462146

2147-
if self.allow_abbrev or not arg_string.startswith('--'):
2148-
# search through all possible prefixes of the option string
2149-
# and all actions in the parser for possible interpretations
2150-
option_tuples = self._get_option_tuples(arg_string)
2151-
2152-
# if multiple actions match, the option string was ambiguous
2153-
if len(option_tuples) > 1:
2154-
options = ', '.join([option_string
2155-
for action, option_string, explicit_arg in option_tuples])
2156-
args = {'option': arg_string, 'matches': options}
2157-
msg = _('ambiguous option: %(option)s could match %(matches)s')
2158-
self.error(msg % args)
2159-
2160-
# if exactly one action matched, this segmentation is good,
2161-
# so return the parsed action
2162-
elif len(option_tuples) == 1:
2163-
option_tuple, = option_tuples
2164-
return option_tuple
2147+
# search through all possible prefixes of the option string
2148+
# and all actions in the parser for possible interpretations
2149+
option_tuples = self._get_option_tuples(arg_string)
2150+
2151+
# if multiple actions match, the option string was ambiguous
2152+
if len(option_tuples) > 1:
2153+
options = ', '.join([option_string
2154+
for action, option_string, explicit_arg in option_tuples])
2155+
args = {'option': arg_string, 'matches': options}
2156+
msg = _('ambiguous option: %(option)s could match %(matches)s')
2157+
self.error(msg % args)
2158+
2159+
# if exactly one action matched, this segmentation is good,
2160+
# so return the parsed action
2161+
elif len(option_tuples) == 1:
2162+
option_tuple, = option_tuples
2163+
return option_tuple
21652164

21662165
# if it was not found as an option, but it looks like a negative
21672166
# number, it was meant to be positional
@@ -2185,16 +2184,17 @@ def _get_option_tuples(self, option_string):
21852184
# split at the '='
21862185
chars = self.prefix_chars
21872186
if option_string[0] in chars and option_string[1] in chars:
2188-
if '=' in option_string:
2189-
option_prefix, explicit_arg = option_string.split('=', 1)
2190-
else:
2191-
option_prefix = option_string
2192-
explicit_arg = None
2193-
for option_string in self._option_string_actions:
2194-
if option_string.startswith(option_prefix):
2195-
action = self._option_string_actions[option_string]
2196-
tup = action, option_string, explicit_arg
2197-
result.append(tup)
2187+
if self.allow_abbrev:
2188+
if '=' in option_string:
2189+
option_prefix, explicit_arg = option_string.split('=', 1)
2190+
else:
2191+
option_prefix = option_string
2192+
explicit_arg = None
2193+
for option_string in self._option_string_actions:
2194+
if option_string.startswith(option_prefix):
2195+
action = self._option_string_actions[option_string]
2196+
tup = action, option_string, explicit_arg
2197+
result.append(tup)
21982198

21992199
# single character options can be concatenated with their arguments
22002200
# but multiple character options always have to have their argument

graalpython/lib-python/3/asyncio/base_events.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,17 @@ async def shutdown_asyncgens(self):
547547
'asyncgen': agen
548548
})
549549

550-
def run_forever(self):
551-
"""Run until stop() is called."""
552-
self._check_closed()
550+
def _check_running(self):
553551
if self.is_running():
554552
raise RuntimeError('This event loop is already running')
555553
if events._get_running_loop() is not None:
556554
raise RuntimeError(
557555
'Cannot run the event loop while another loop is running')
556+
557+
def run_forever(self):
558+
"""Run until stop() is called."""
559+
self._check_closed()
560+
self._check_running()
558561
self._set_coroutine_origin_tracking(self._debug)
559562
self._thread_id = threading.get_ident()
560563

@@ -586,6 +589,7 @@ def run_until_complete(self, future):
586589
Return the Future's result, or raise its exception.
587590
"""
588591
self._check_closed()
592+
self._check_running()
589593

590594
new_task = not futures.isfuture(future)
591595
future = tasks.ensure_future(future, loop=self)

graalpython/lib-python/3/asyncio/staggered.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import typing
77

88
from . import events
9-
from . import futures
9+
from . import exceptions as exceptions_mod
1010
from . import locks
1111
from . import tasks
1212

@@ -83,7 +83,7 @@ async def run_one_coro(
8383
previous_failed: typing.Optional[locks.Event]) -> None:
8484
# Wait for the previous task to finish, or for delay seconds
8585
if previous_failed is not None:
86-
with contextlib.suppress(futures.TimeoutError):
86+
with contextlib.suppress(exceptions_mod.TimeoutError):
8787
# Use asyncio.wait_for() instead of asyncio.wait() here, so
8888
# that if we get cancelled at this point, Event.wait() is also
8989
# cancelled, otherwise there will be a "Task destroyed but it is

graalpython/lib-python/3/asyncio/unix_events.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,14 @@ def is_active(self):
12661266
return True
12671267

12681268
def close(self):
1269-
pass
1269+
self._join_threads()
1270+
1271+
def _join_threads(self):
1272+
"""Internal: Join all non-daemon threads"""
1273+
threads = [thread for thread in list(self._threads.values())
1274+
if thread.is_alive() and not thread.daemon]
1275+
for thread in threads:
1276+
thread.join()
12701277

12711278
def __enter__(self):
12721279
return self

graalpython/lib-python/3/base64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def b64decode(s, altchars=None, validate=False):
8282
altchars = _bytes_from_decode_data(altchars)
8383
assert len(altchars) == 2, repr(altchars)
8484
s = s.translate(bytes.maketrans(altchars, b'+/'))
85-
if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
85+
if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s):
8686
raise binascii.Error('Non-base64 digit found')
8787
return binascii.a2b_base64(s)
8888

graalpython/lib-python/3/bdb.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,14 +548,7 @@ def format_stack_entry(self, frame_lineno, lprefix=': '):
548548
s += frame.f_code.co_name
549549
else:
550550
s += "<lambda>"
551-
if '__args__' in frame.f_locals:
552-
args = frame.f_locals['__args__']
553-
else:
554-
args = None
555-
if args:
556-
s += reprlib.repr(args)
557-
else:
558-
s += '()'
551+
s += '()'
559552
if '__return__' in frame.f_locals:
560553
rv = frame.f_locals['__return__']
561554
s += '->'

0 commit comments

Comments
 (0)