Skip to content

Commit cdc2cd5

Browse files
committed
Merge branch 'origin/master' into release/graal-vm/1.0
2 parents 45547b6 + 52664d8 commit cdc2cd5

File tree

201 files changed

+9077
-2771
lines changed

Some content is hidden

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

201 files changed

+9077
-2771
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
This changelog summarizes major changes between GraalVM versions of the Python
44
language runtime. The main focus is on user-observable behavior of the engine.
55

6+
## Version 1.0.0 RC3
7+
8+
* Support for more String encodings
9+
* Implement buffered I/O
10+
* Remove our random module substitute and use the standard library implementation
11+
* Fix a potential thread-safety problem with cached parse trees when multiple Python contexts are used from multiple threads
12+
* Complete support for math module builtins
13+
* C-API improvements to run simple scikit-learn and NumPy examples
14+
* Support the buffer protocol to wrap arbitrary Python sequences with no copy into NumPy arrays
15+
616
## Version 1.0.0 RC2
717

818
* Updates to the polyglot and embedding APIs

ci.jsonnet

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
overlay: "2081dc054251c6658f7ce8f4b6671a474edbf2f6",
2+
overlay: "03b824f947adf9a67c80c3e8a27646d43a687bfb",
33

44
// ======================================================================================================
55
//
@@ -124,8 +124,8 @@
124124

125125
local labsjdk8Mixin = {
126126
downloads +: {
127-
JAVA_HOME: utils.download("labsjdk", "8u161-jvmci-0.42"),
128-
EXTRA_JAVA_HOMES : { pathlist: [utils.download("oraclejdk", "9.0.4+11")] },
127+
JAVA_HOME: utils.download("labsjdk", "8u172-jvmci-0.46"),
128+
EXTRA_JAVA_HOMES : { pathlist: [utils.download("oraclejdk", "11+20")] },
129129
},
130130
environment +: {
131131
CI: "true",

graalpython/benchmarks/src/benchmarks/interop/python_r_image_demo.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
# SOFTWARE.
3737

38+
import polyglot
3839
import sys
3940
import os
4041

@@ -44,21 +45,19 @@
4445

4546
from image_magix import Image
4647

47-
MIME_R = "application/x-r"
48-
49-
load_jpeg = eval(compile("""function(file.name) {
48+
load_jpeg = polyglot.eval(string="""function(file.name) {
5049
jimg <- read.csv(gzfile(file.name))
5150
return (jimg)
52-
}""", "", MIME_R))
51+
}""", language="R")
5352

5453
print("stage 1")
5554

5655
working_dir_parts.append("img.csv.gz")
5756
raw_data = load_jpeg(os.sep.join(working_dir_parts))
5857

5958
# the dimensions are R attributes; define function to access them
60-
getDim = eval(compile("function(v, pos) dim(v)[[pos]]", "", MIME_R))
61-
getDataRowMajor = eval(compile("function(v) as.vector(t(v))", "", MIME_R))
59+
getDim = polyglot.eval(string="function(v, pos) dim(v)[[pos]]", language="R")
60+
getDataRowMajor = polyglot.eval(string="function(v) as.vector(t(v))", language="R")
6261

6362
print("stage 2")
6463

@@ -77,17 +76,16 @@
7776

7877
print("stage 3")
7978

80-
draw = eval(compile("""function(processedImgObj) {
79+
draw = polyglot.eval(string="""function(processedImgObj) {
8180
require(grDevices)
8281
require(grid)
8382
mx <- matrix(processedImgObj$`@data`/255, nrow=processedImgObj$`@height`, ncol=processedImgObj$`@width`)
8483
cat("rows:", nrow(mx), "\n")
8584
grid.newpage()
8685
grid.raster(mx, height=unit(nrow(mx),"points"))
8786
cat("DONE\n")
88-
}""", "", MIME_R))
87+
}""", language="R")
8988

9089
draw(result)
9190

92-
eval(compile("dev.off()", "", MIME_R))
93-
91+
polyglot.eval(string="dev.off()", language="R")

graalpython/com.oracle.graal.python.cext/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ default: ${TARGET_LIB} ${MODULE_TARGETS} ${HEADER_TARGETS}
5555

5656
CFLAGS=${LLVM_TARGET_FLAGS} -ggdb -emit-llvm
5757
OPT_FLAGS=-mem2reg -globalopt -simplifycfg -constprop -always-inline -instcombine -dse -loop-simplify -reassociate -licm -gvn
58-
WARNINGS=-Wno-int-to-pointer-cast -Wno-int-conversion -Wno-incompatible-pointer-types-discards-qualifiers
59-
INCLUDES=-I${VPATH}/include
58+
WARNINGS=-Wno-int-to-pointer-cast -Wno-int-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-pointer-type-mismatch
59+
INCLUDES=-I${POLYGLOT_INC} -I${VPATH}/include
6060

6161

6262
rebuild:

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define HAVE_SYS_WAIT_H
4747

4848
#define PYPY_VERSION 0
49+
#define PYPY_VERSION_NUM 0
4950

5051
#include <truffle.h>
5152
#include <polyglot.h>
@@ -61,6 +62,7 @@
6162
#include <langinfo.h>
6263
#include <assert.h>
6364
#include <unistd.h>
65+
#include <math.h>
6466

6567
#include "pyport.h"
6668
#include "pymacro.h"
@@ -71,6 +73,7 @@
7173
#include "unicodeobject.h"
7274
#include "pystate.h"
7375
#include "pyarena.h"
76+
#include "compile.h"
7477
#include "pythonrun.h"
7578
#include "ceval.h"
7679
#include "pyerrors.h"
@@ -106,6 +109,12 @@
106109
#include "code.h"
107110
#include "pyfpe.h"
108111
#include "memoryobject.h"
112+
#include "pystrhex.h"
113+
#include "codecs.h"
114+
#include "frameobject.h"
115+
#include "traceback.h"
116+
#include "classobject.h"
117+
#include "pythread.h"
109118

110119
#define PY_TRUFFLE_CEXT ((void*)polyglot_import("python_cext"))
111120
#define PY_BUILTIN ((void*)polyglot_import("python_builtins"))
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* Copyright (c) 2018, 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+
/* Former class object interface -- now only bound methods are here */
7+
8+
/* Revealing some structures (not for general use) */
9+
10+
#ifndef Py_LIMITED_API
11+
#ifndef Py_CLASSOBJECT_H
12+
#define Py_CLASSOBJECT_H
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
typedef struct {
18+
PyObject_HEAD
19+
PyObject *im_func; /* The callable object implementing the method */
20+
PyObject *im_self; /* The instance it is bound to */
21+
PyObject *im_weakreflist; /* List of weak references */
22+
} PyMethodObject;
23+
24+
PyAPI_DATA(PyTypeObject) PyMethod_Type;
25+
26+
#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
27+
28+
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
29+
30+
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
31+
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
32+
33+
/* Macros for direct access to these values. Type checks are *not*
34+
done, so use with care. */
35+
#define PyMethod_GET_FUNCTION(meth) \
36+
(((PyMethodObject *)meth) -> im_func)
37+
#define PyMethod_GET_SELF(meth) \
38+
(((PyMethodObject *)meth) -> im_self)
39+
40+
PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
41+
42+
typedef struct {
43+
PyObject_HEAD
44+
PyObject *func;
45+
} PyInstanceMethodObject;
46+
47+
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
48+
49+
#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
50+
51+
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
52+
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
53+
54+
/* Macros for direct access to these values. Type checks are *not*
55+
done, so use with care. */
56+
#define PyInstanceMethod_GET_FUNCTION(meth) \
57+
(((PyInstanceMethodObject *)meth) -> func)
58+
59+
#ifdef __cplusplus
60+
}
61+
#endif
62+
#endif /* !Py_CLASSOBJECT_H */
63+
#endif /* Py_LIMITED_API */

0 commit comments

Comments
 (0)