Skip to content

Commit 4c10d81

Browse files
committed
Merge branch 'python-import' into tim/update-python-3.10.13
2 parents 844c2c8 + 8d8cd4c commit 4c10d81

191 files changed

Lines changed: 7536 additions & 2670 deletions

File tree

Some content is hidden

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
/*--start constants--*/
2424
#define PY_MAJOR_VERSION 3
2525
#define PY_MINOR_VERSION 10
26-
#define PY_MICRO_VERSION 8
26+
#define PY_MICRO_VERSION 13
2727
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
2828
#define PY_RELEASE_SERIAL 0
2929

3030
/* Version as a string */
31-
#define PY_VERSION "3.10.8"
31+
#define PY_VERSION "3.10.13"
3232
/*--end constants--*/
3333

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

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

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
15381538
#endif
15391539

15401540
/* Report failure */
1541-
#define FAIL do { VTRACE(("FAIL: %d\n", __LINE__)); return 0; } while (0)
1541+
#define FAIL do { VTRACE(("FAIL: %d\n", __LINE__)); return -1; } while (0)
15421542

15431543
/* Extract opcode, argument, or skip count from code array */
15441544
#define GET_OP \
@@ -1562,7 +1562,7 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
15621562
skip = *code; \
15631563
VTRACE(("%lu (skip to %p)\n", \
15641564
(unsigned long)skip, code+skip)); \
1565-
if (skip-adj > (uintptr_t)(end - code)) \
1565+
if (skip-adj > (uintptr_t)(end - code)) \
15661566
FAIL; \
15671567
code++; \
15681568
} while (0)
@@ -1651,9 +1651,10 @@ _validate_charset(SRE_CODE *code, SRE_CODE *end)
16511651
}
16521652
}
16531653

1654-
return 1;
1654+
return 0;
16551655
}
16561656

1657+
/* Returns 0 on success, -1 on failure, and 1 if the last op is JUMP. */
16571658
static int
16581659
_validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
16591660
{
@@ -1731,7 +1732,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
17311732
case SRE_OP_IN_LOC_IGNORE:
17321733
GET_SKIP;
17331734
/* Stop 1 before the end; we check the FAILURE below */
1734-
if (!_validate_charset(code, code+skip-2))
1735+
if (_validate_charset(code, code+skip-2))
17351736
FAIL;
17361737
if (code[skip-2] != SRE_OP_FAILURE)
17371738
FAIL;
@@ -1785,7 +1786,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
17851786
}
17861787
/* Validate the charset */
17871788
if (flags & SRE_INFO_CHARSET) {
1788-
if (!_validate_charset(code, newcode-1))
1789+
if (_validate_charset(code, newcode-1))
17891790
FAIL;
17901791
if (newcode[-1] != SRE_OP_FAILURE)
17911792
FAIL;
@@ -1806,7 +1807,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
18061807
if (skip == 0)
18071808
break;
18081809
/* Stop 2 before the end; we check the JUMP below */
1809-
if (!_validate_inner(code, code+skip-3, groups))
1810+
if (_validate_inner(code, code+skip-3, groups))
18101811
FAIL;
18111812
code += skip-3;
18121813
/* Check that it ends with a JUMP, and that each JUMP
@@ -1820,6 +1821,8 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
18201821
else if (code+skip-1 != target)
18211822
FAIL;
18221823
}
1824+
if (code != target)
1825+
FAIL;
18231826
}
18241827
break;
18251828

@@ -1834,7 +1837,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
18341837
FAIL;
18351838
if (max > SRE_MAXREPEAT)
18361839
FAIL;
1837-
if (!_validate_inner(code, code+skip-4, groups))
1840+
if (_validate_inner(code, code+skip-4, groups))
18381841
FAIL;
18391842
code += skip-4;
18401843
GET_OP;
@@ -1853,7 +1856,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
18531856
FAIL;
18541857
if (max > SRE_MAXREPEAT)
18551858
FAIL;
1856-
if (!_validate_inner(code, code+skip-3, groups))
1859+
if (_validate_inner(code, code+skip-3, groups))
18571860
FAIL;
18581861
code += skip-3;
18591862
GET_OP;
@@ -1905,24 +1908,17 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
19051908
to allow arbitrary jumps anywhere in the code; so we just look
19061909
for a JUMP opcode preceding our skip target.
19071910
*/
1908-
if (skip >= 3 && skip-3 < (uintptr_t)(end - code) &&
1909-
code[skip-3] == SRE_OP_JUMP)
1910-
{
1911-
VTRACE(("both then and else parts present\n"));
1912-
if (!_validate_inner(code+1, code+skip-3, groups))
1913-
FAIL;
1911+
VTRACE(("then part:\n"));
1912+
int rc = _validate_inner(code+1, code+skip-1, groups);
1913+
if (rc == 1) {
1914+
VTRACE(("else part:\n"));
19141915
code += skip-2; /* Position after JUMP, at <skipno> */
19151916
GET_SKIP;
1916-
if (!_validate_inner(code, code+skip-1, groups))
1917-
FAIL;
1918-
code += skip-1;
1919-
}
1920-
else {
1921-
VTRACE(("only a then part present\n"));
1922-
if (!_validate_inner(code+1, code+skip-1, groups))
1923-
FAIL;
1924-
code += skip-1;
1917+
rc = _validate_inner(code, code+skip-1, groups);
19251918
}
1919+
if (rc)
1920+
FAIL;
1921+
code += skip-1;
19261922
break;
19271923

19281924
case SRE_OP_ASSERT:
@@ -1933,22 +1929,28 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
19331929
if (arg & 0x80000000)
19341930
FAIL; /* Width too large */
19351931
/* Stop 1 before the end; we check the SUCCESS below */
1936-
if (!_validate_inner(code+1, code+skip-2, groups))
1932+
if (_validate_inner(code+1, code+skip-2, groups))
19371933
FAIL;
19381934
code += skip-2;
19391935
GET_OP;
19401936
if (op != SRE_OP_SUCCESS)
19411937
FAIL;
19421938
break;
19431939

1940+
case SRE_OP_JUMP:
1941+
if (code + 1 != end)
1942+
FAIL;
1943+
VTRACE(("JUMP: %d\n", __LINE__));
1944+
return 1;
1945+
19441946
default:
19451947
FAIL;
19461948

19471949
}
19481950
}
19491951

19501952
VTRACE(("okay\n"));
1951-
return 1;
1953+
return 0;
19521954
}
19531955

19541956
static int
@@ -1963,7 +1965,7 @@ _validate_outer(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
19631965
static int
19641966
_validate(PatternObject *self)
19651967
{
1966-
if (!_validate_outer(self->code, self->code+self->codesize, self->groups))
1968+
if (_validate_outer(self->code, self->code+self->codesize, self->groups))
19671969
{
19681970
PyErr_SetString(PyExc_RuntimeError, "invalid SRE code");
19691971
return 0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ is_normalized_quickcheck(PyObject *self, PyObject *input, bool nfc, bool k,
810810
{
811811
/* UCD 3.2.0 is requested, quickchecks must be disabled. */
812812
if (UCD_Check(self)) {
813-
return NO;
813+
return MAYBE;
814814
}
815815

816816
Py_ssize_t i, len;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,12 @@ EXPORT (HRESULT) KeepObject(IUnknown *punk)
10371037

10381038
#endif
10391039

1040+
EXPORT(int)
1041+
_testfunc_pylist_append(PyObject *list, PyObject *item)
1042+
{
1043+
return PyList_Append(list, item);
1044+
}
1045+
10401046
static struct PyModuleDef_Slot _ctypes_test_slots[] = {
10411047
{0, NULL}
10421048
};

0 commit comments

Comments
 (0)