Skip to content

Commit 5acf98e

Browse files
committed
[GR-15938] Update to CPython 3.7.3
PullRequest: graalpython/530
2 parents e9e5e66 + 368532b commit 5acf98e

File tree

498 files changed

+16734
-4838
lines changed

Some content is hidden

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

498 files changed

+16734
-4838
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
#include "typeslots.h"
124124
#include "weakrefobject.h"
125125
#include "sysmodule.h"
126+
#include "fileutils.h"
126127

127128
// TODO: we must extend the refcounting behavior to support handles to managed objects
128129
#undef Py_DECREF

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
5353
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
5454
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
5555

56+
#ifndef Py_LIMITED_API
57+
/* Helper to look up a builtin object */
58+
PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *);
5659
/* Look at the current frame's (if any) code's co_flags, and turn on
5760
the corresponding compiler flags in cf->cf_flags. Return 1 if any
5861
flag was set, else return 0. */
59-
#ifndef Py_LIMITED_API
6062
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
6163
#endif
6264

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/* Copyright (c) 2019, Oracle and/or its affiliates.
2+
* Copyright (C) 1996-2017 Python Software Foundation
3+
*
4+
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
5+
*/
6+
#ifndef Py_FILEUTILS_H
7+
#define Py_FILEUTILS_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
14+
PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
15+
const char *arg,
16+
size_t *size);
17+
18+
PyAPI_FUNC(char*) Py_EncodeLocale(
19+
const wchar_t *text,
20+
size_t *error_pos);
21+
22+
PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
23+
const wchar_t *text,
24+
size_t *error_pos);
25+
#endif
26+
27+
#ifdef Py_BUILD_CORE
28+
PyAPI_FUNC(int) _Py_DecodeUTF8Ex(
29+
const char *arg,
30+
Py_ssize_t arglen,
31+
wchar_t **wstr,
32+
size_t *wlen,
33+
const char **reason,
34+
int surrogateescape);
35+
36+
PyAPI_FUNC(int) _Py_EncodeUTF8Ex(
37+
const wchar_t *text,
38+
char **str,
39+
size_t *error_pos,
40+
const char **reason,
41+
int raw_malloc,
42+
int surrogateescape);
43+
44+
PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape(
45+
const char *arg,
46+
Py_ssize_t arglen);
47+
48+
PyAPI_FUNC(int) _Py_DecodeLocaleEx(
49+
const char *arg,
50+
wchar_t **wstr,
51+
size_t *wlen,
52+
const char **reason,
53+
int current_locale,
54+
int surrogateescape);
55+
56+
PyAPI_FUNC(int) _Py_EncodeLocaleEx(
57+
const wchar_t *text,
58+
char **str,
59+
size_t *error_pos,
60+
const char **reason,
61+
int current_locale,
62+
int surrogateescape);
63+
#endif
64+
65+
#ifndef Py_LIMITED_API
66+
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
67+
68+
#if defined(MS_WINDOWS) || defined(__APPLE__)
69+
/* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611).
70+
On macOS 10.13, read() and write() with more than INT_MAX bytes
71+
fail with EINVAL (bpo-24658). */
72+
# define _PY_READ_MAX INT_MAX
73+
# define _PY_WRITE_MAX INT_MAX
74+
#else
75+
/* write() should truncate the input to PY_SSIZE_T_MAX bytes,
76+
but it's safer to do it ourself to have a portable behaviour */
77+
# define _PY_READ_MAX PY_SSIZE_T_MAX
78+
# define _PY_WRITE_MAX PY_SSIZE_T_MAX
79+
#endif
80+
81+
#ifdef MS_WINDOWS
82+
struct _Py_stat_struct {
83+
unsigned long st_dev;
84+
uint64_t st_ino;
85+
unsigned short st_mode;
86+
int st_nlink;
87+
int st_uid;
88+
int st_gid;
89+
unsigned long st_rdev;
90+
__int64 st_size;
91+
time_t st_atime;
92+
int st_atime_nsec;
93+
time_t st_mtime;
94+
int st_mtime_nsec;
95+
time_t st_ctime;
96+
int st_ctime_nsec;
97+
unsigned long st_file_attributes;
98+
};
99+
#else
100+
# define _Py_stat_struct stat
101+
#endif
102+
103+
PyAPI_FUNC(int) _Py_fstat(
104+
int fd,
105+
struct _Py_stat_struct *status);
106+
107+
PyAPI_FUNC(int) _Py_fstat_noraise(
108+
int fd,
109+
struct _Py_stat_struct *status);
110+
111+
PyAPI_FUNC(int) _Py_stat(
112+
PyObject *path,
113+
struct stat *status);
114+
115+
PyAPI_FUNC(int) _Py_open(
116+
const char *pathname,
117+
int flags);
118+
119+
PyAPI_FUNC(int) _Py_open_noraise(
120+
const char *pathname,
121+
int flags);
122+
123+
PyAPI_FUNC(FILE *) _Py_wfopen(
124+
const wchar_t *path,
125+
const wchar_t *mode);
126+
127+
PyAPI_FUNC(FILE*) _Py_fopen(
128+
const char *pathname,
129+
const char *mode);
130+
131+
PyAPI_FUNC(FILE*) _Py_fopen_obj(
132+
PyObject *path,
133+
const char *mode);
134+
135+
PyAPI_FUNC(Py_ssize_t) _Py_read(
136+
int fd,
137+
void *buf,
138+
size_t count);
139+
140+
PyAPI_FUNC(Py_ssize_t) _Py_write(
141+
int fd,
142+
const void *buf,
143+
size_t count);
144+
145+
PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
146+
int fd,
147+
const void *buf,
148+
size_t count);
149+
150+
#ifdef HAVE_READLINK
151+
PyAPI_FUNC(int) _Py_wreadlink(
152+
const wchar_t *path,
153+
wchar_t *buf,
154+
size_t bufsiz);
155+
#endif
156+
157+
#ifdef HAVE_REALPATH
158+
PyAPI_FUNC(wchar_t*) _Py_wrealpath(
159+
const wchar_t *path,
160+
wchar_t *resolved_path,
161+
size_t resolved_path_size);
162+
#endif
163+
164+
PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
165+
wchar_t *buf,
166+
size_t size);
167+
168+
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
169+
170+
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
171+
int *atomic_flag_works);
172+
173+
PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable,
174+
int *atomic_flag_works);
175+
176+
PyAPI_FUNC(int) _Py_dup(int fd);
177+
178+
#ifndef MS_WINDOWS
179+
PyAPI_FUNC(int) _Py_get_blocking(int fd);
180+
181+
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
182+
#endif /* !MS_WINDOWS */
183+
184+
PyAPI_FUNC(int) _Py_GetLocaleconvNumeric(
185+
PyObject **decimal_point,
186+
PyObject **thousands_sep,
187+
const char **grouping);
188+
189+
#endif /* Py_LIMITED_API */
190+
191+
#ifdef Py_BUILD_CORE
192+
PyAPI_FUNC(int) _Py_GetForceASCII(void);
193+
194+
/* Reset "force ASCII" mode (if it was initialized).
195+
196+
This function should be called when Python changes the LC_CTYPE locale,
197+
so the "force ASCII" mode can be detected again on the new locale
198+
encoding. */
199+
PyAPI_FUNC(void) _Py_ResetForceASCII(void);
200+
#endif
201+
202+
#ifdef __cplusplus
203+
}
204+
#endif
205+
206+
#endif /* !Py_FILEUTILS_H */

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
6363
PyObject *name
6464
);
6565
#endif
66-
#ifndef Py_LIMITED_API
67-
PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *);
68-
#endif
6966
PyAPI_FUNC(PyObject *) PyImport_AddModule(
7067
const char *name /* UTF-8 encoded string */
7168
);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ struct _Py_Identifier;
526526
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
527527
PyAPI_FUNC(void) _Py_BreakPoint(void);
528528
PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
529+
PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *);
529530
#endif
530531
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
531532
PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);

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 7
26-
#define PY_MICRO_VERSION 0
26+
#define PY_MICRO_VERSION 3
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.7.0"
31+
#define PY_VERSION "3.7.3"
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/include/pyerrors.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);
9999
#endif
100100

101101
#if defined(__clang__) || \
102-
(defined(__GNUC_MAJOR__) && \
103-
((__GNUC_MAJOR__ >= 3) || \
104-
(__GNUC_MAJOR__ == 2) && (__GNUC_MINOR__ >= 5)))
102+
(defined(__GNUC__) && \
103+
((__GNUC__ >= 3) || \
104+
(__GNUC__ == 2) && (__GNUC_MINOR__ >= 5)))
105105
#define _Py_NO_RETURN __attribute__((__noreturn__))
106106
#else
107107
#define _Py_NO_RETURN

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

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,36 @@ PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
4949
PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
5050

5151
#ifndef Py_LIMITED_API
52+
PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *);
53+
5254
/* Only used by applications that embed the interpreter and need to
5355
* override the standard encoding determination mechanism
5456
*/
5557
PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
5658
const char *errors);
5759

5860
/* PEP 432 Multi-phase initialization API (Private while provisional!) */
59-
PyAPI_FUNC(_PyInitError) _Py_InitializeCore(const _PyCoreConfig *);
61+
PyAPI_FUNC(_PyInitError) _Py_InitializeCore(
62+
PyInterpreterState **interp_p,
63+
const _PyCoreConfig *config);
6064
PyAPI_FUNC(int) _Py_IsCoreInitialized(void);
65+
PyAPI_FUNC(_PyInitError) _Py_InitializeFromConfig(
66+
const _PyCoreConfig *config);
67+
#ifdef Py_BUILD_CORE
68+
PyAPI_FUNC(void) _Py_Initialize_ReadEnvVarsNoAlloc(void);
69+
#endif
70+
71+
PyAPI_FUNC(PyObject *) _Py_GetGlobalVariablesAsDict(void);
6172

6273
PyAPI_FUNC(_PyInitError) _PyCoreConfig_Read(_PyCoreConfig *);
6374
PyAPI_FUNC(void) _PyCoreConfig_Clear(_PyCoreConfig *);
6475
PyAPI_FUNC(int) _PyCoreConfig_Copy(
6576
_PyCoreConfig *config,
6677
const _PyCoreConfig *config2);
78+
PyAPI_FUNC(PyObject *) _PyCoreConfig_AsDict(const _PyCoreConfig *config);
79+
PyAPI_FUNC(void) _PyCoreConfig_SetGlobalConfig(
80+
const _PyCoreConfig *config);
81+
6782

6883
PyAPI_FUNC(_PyInitError) _PyMainInterpreterConfig_Read(
6984
_PyMainInterpreterConfig *config,
@@ -72,19 +87,26 @@ PyAPI_FUNC(void) _PyMainInterpreterConfig_Clear(_PyMainInterpreterConfig *);
7287
PyAPI_FUNC(int) _PyMainInterpreterConfig_Copy(
7388
_PyMainInterpreterConfig *config,
7489
const _PyMainInterpreterConfig *config2);
90+
/* Used by _testcapi.get_main_config() */
91+
PyAPI_FUNC(PyObject*) _PyMainInterpreterConfig_AsDict(
92+
const _PyMainInterpreterConfig *config);
93+
94+
PyAPI_FUNC(_PyInitError) _Py_InitializeMainInterpreter(
95+
PyInterpreterState *interp,
96+
const _PyMainInterpreterConfig *config);
97+
#endif /* !defined(Py_LIMITED_API) */
7598

76-
PyAPI_FUNC(_PyInitError) _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *);
77-
#endif
7899

79100
/* Initialization and finalization */
80101
PyAPI_FUNC(void) Py_Initialize(void);
81102
PyAPI_FUNC(void) Py_InitializeEx(int);
82103
#ifndef Py_LIMITED_API
83-
PyAPI_FUNC(_PyInitError) _Py_InitializeEx_Private(int, int);
84104
PyAPI_FUNC(void) _Py_FatalInitError(_PyInitError err) _Py_NO_RETURN;
85105
#endif
86106
PyAPI_FUNC(void) Py_Finalize(void);
107+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
87108
PyAPI_FUNC(int) Py_FinalizeEx(void);
109+
#endif
88110
PyAPI_FUNC(int) Py_IsInitialized(void);
89111

90112
/* Subinterpreter support */

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ PyAPI_FUNC(int) PyTraceMalloc_Untrack(
6060
PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
6161
unsigned int domain,
6262
uintptr_t ptr);
63-
#endif /* !Py_LIMITED_API */
63+
64+
PyAPI_FUNC(int) _PyMem_IsFreed(void *ptr, size_t size);
65+
#endif /* !defined(Py_LIMITED_API) */
6466

6567

6668
/* BEWARE:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ typedef struct {
8484
#define _PyCoreConfig_INIT \
8585
(_PyCoreConfig){ \
8686
.install_signal_handlers = -1, \
87+
.ignore_environment = -1, \
8788
.use_hash_seed = -1, \
8889
.coerce_c_locale = -1, \
90+
.faulthandler = -1, \
91+
.tracemalloc = -1, \
8992
.utf8_mode = -1, \
9093
.argc = -1, \
9194
.nmodule_search_path = -1}

0 commit comments

Comments
 (0)