Skip to content

Commit a792079

Browse files
committed
[GR-53366] Add more patches for cryptography
PullRequest: graalpython/3324
2 parents 0e5347a + 533216b commit a792079

File tree

9 files changed

+300
-4
lines changed

9 files changed

+300
-4
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,19 @@ PyGILState_Release(PyGILState_STATE oldstate)
190190
}
191191
}
192192
}
193+
194+
// GraalPy change: We don't have subinterpreters at the moment, so store the dict into a global object
195+
static PyObject* interpreter_dict;
196+
197+
PyObject *
198+
PyInterpreterState_GetDict(PyInterpreterState *interp)
199+
{
200+
if (interpreter_dict == NULL) {
201+
interpreter_dict = PyDict_New();
202+
if (interpreter_dict == NULL) {
203+
PyErr_Clear();
204+
}
205+
}
206+
/* Returning NULL means no per-interpreter dict is available. */
207+
return interpreter_dict;
208+
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ public final class CApiFunction {
291291
@CApiBuiltin(name = "PyImport_AddModuleObject", ret = PyObject, args = {PyObject}, call = CImpl)
292292
@CApiBuiltin(name = "PyImport_ImportModuleLevel", ret = PyObject, args = {ConstCharPtrAsTruffleString, PyObject, PyObject, PyObject, Int}, call = CImpl)
293293
@CApiBuiltin(name = "PyInstanceMethod_Function", ret = PyObject, args = {PyObject}, call = CImpl)
294+
@CApiBuiltin(name = "PyInterpreterState_GetDict", ret = PyObject, args = {PyInterpreterState}, call = CImpl)
294295
@CApiBuiltin(name = "PyInterpreterState_GetID", ret = INT64_T, args = {PyInterpreterState}, call = CImpl)
295296
@CApiBuiltin(name = "PyInterpreterState_GetIDFromThreadState", ret = INT64_T, args = {PyThreadState}, call = CImpl)
296297
@CApiBuiltin(name = "PyInterpreterState_Main", ret = PyInterpreterState, args = {}, call = CImpl)
@@ -773,7 +774,6 @@ public final class CApiFunction {
773774
@CApiBuiltin(name = "PyInterpreterState_Clear", ret = Void, args = {PyInterpreterState}, call = NotImplemented)
774775
@CApiBuiltin(name = "PyInterpreterState_Delete", ret = Void, args = {PyInterpreterState}, call = NotImplemented)
775776
@CApiBuiltin(name = "PyInterpreterState_Get", ret = PyInterpreterState, args = {}, call = NotImplemented)
776-
@CApiBuiltin(name = "PyInterpreterState_GetDict", ret = PyObject, args = {PyInterpreterState}, call = NotImplemented)
777777
@CApiBuiltin(name = "PyInterpreterState_Head", ret = PyInterpreterState, args = {}, call = NotImplemented)
778778
@CApiBuiltin(name = "PyInterpreterState_New", ret = PyInterpreterState, args = {}, call = NotImplemented)
779779
@CApiBuiltin(name = "PyInterpreterState_Next", ret = PyInterpreterState, args = {PyInterpreterState}, call = NotImplemented)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
2+
index e1fd955..f65dba8 100644
3+
--- a/src/rust/Cargo.lock
4+
+++ b/src/rust/Cargo.lock
5+
@@ -327,8 +327,7 @@ dependencies = [
6+
[[package]]
7+
name = "pyo3"
8+
version = "0.15.2"
9+
-source = "registry+https://github.com/rust-lang/crates.io-index"
10+
-checksum = "d41d50a7271e08c7c8a54cd24af5d62f73ee3a6f6a314215281ebdec421d5752"
11+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
12+
dependencies = [
13+
"cfg-if",
14+
"indoc",
15+
@@ -343,8 +342,7 @@ dependencies = [
16+
[[package]]
17+
name = "pyo3-build-config"
18+
version = "0.15.2"
19+
-source = "registry+https://github.com/rust-lang/crates.io-index"
20+
-checksum = "779239fc40b8e18bc8416d3a37d280ca9b9fb04bda54b98037bb6748595c2410"
21+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
22+
dependencies = [
23+
"once_cell",
24+
]
25+
@@ -352,8 +350,7 @@ dependencies = [
26+
[[package]]
27+
name = "pyo3-macros"
28+
version = "0.15.2"
29+
-source = "registry+https://github.com/rust-lang/crates.io-index"
30+
-checksum = "00b247e8c664be87998d8628e86f282c25066165f1f8dda66100c48202fdb93a"
31+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
32+
dependencies = [
33+
"pyo3-macros-backend",
34+
"quote",
35+
@@ -363,8 +360,7 @@ dependencies = [
36+
[[package]]
37+
name = "pyo3-macros-backend"
38+
version = "0.15.2"
39+
-source = "registry+https://github.com/rust-lang/crates.io-index"
40+
-checksum = "5a8c2812c412e00e641d99eeb79dd478317d981d938aa60325dfa7157b607095"
41+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
42+
dependencies = [
43+
"proc-macro2",
44+
"pyo3-build-config",
45+
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
46+
index 271b290..7f151ed 100644
47+
--- a/src/rust/Cargo.toml
48+
+++ b/src/rust/Cargo.toml
49+
@@ -7,7 +7,7 @@ publish = false
50+
51+
[dependencies]
52+
once_cell = "1"
53+
-pyo3 = { version = "0.15.2" }
54+
+pyo3 = { git = "https://github.com/timfel/pyo3.git", branch = "v0.15.2.graalpy" }
55+
asn1 = { version = "0.12.1", default-features = false, features = ["derive"] }
56+
pem = "1.1"
57+
chrono = { version = "0.4.22", default-features = false, features = ["alloc", "clock"] }
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
2+
index 4a0ecfd..9a19c80 100644
3+
--- a/src/rust/Cargo.lock
4+
+++ b/src/rust/Cargo.lock
5+
@@ -327,8 +327,7 @@ dependencies = [
6+
[[package]]
7+
name = "pyo3"
8+
version = "0.15.2"
9+
-source = "registry+https://github.com/rust-lang/crates.io-index"
10+
-checksum = "d41d50a7271e08c7c8a54cd24af5d62f73ee3a6f6a314215281ebdec421d5752"
11+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
12+
dependencies = [
13+
"cfg-if",
14+
"indoc",
15+
@@ -343,8 +342,7 @@ dependencies = [
16+
[[package]]
17+
name = "pyo3-build-config"
18+
version = "0.15.2"
19+
-source = "registry+https://github.com/rust-lang/crates.io-index"
20+
-checksum = "779239fc40b8e18bc8416d3a37d280ca9b9fb04bda54b98037bb6748595c2410"
21+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
22+
dependencies = [
23+
"once_cell",
24+
]
25+
@@ -352,8 +350,7 @@ dependencies = [
26+
[[package]]
27+
name = "pyo3-macros"
28+
version = "0.15.2"
29+
-source = "registry+https://github.com/rust-lang/crates.io-index"
30+
-checksum = "00b247e8c664be87998d8628e86f282c25066165f1f8dda66100c48202fdb93a"
31+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
32+
dependencies = [
33+
"pyo3-macros-backend",
34+
"quote",
35+
@@ -363,8 +360,7 @@ dependencies = [
36+
[[package]]
37+
name = "pyo3-macros-backend"
38+
version = "0.15.2"
39+
-source = "registry+https://github.com/rust-lang/crates.io-index"
40+
-checksum = "5a8c2812c412e00e641d99eeb79dd478317d981d938aa60325dfa7157b607095"
41+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
42+
dependencies = [
43+
"proc-macro2",
44+
"pyo3-build-config",
45+
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
46+
index 49e70a3..8d94f34 100644
47+
--- a/src/rust/Cargo.toml
48+
+++ b/src/rust/Cargo.toml
49+
@@ -7,7 +7,7 @@ publish = false
50+
51+
[dependencies]
52+
once_cell = "1"
53+
-pyo3 = { version = "0.15.2" }
54+
+pyo3 = { git = "https://github.com/timfel/pyo3.git", branch = "v0.15.2.graalpy" }
55+
asn1 = { version = "0.12.2", default-features = false, features = ["derive"] }
56+
pem = "1.1"
57+
chrono = { version = "0.4.22", default-features = false, features = ["alloc", "clock"] }
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
2+
index 02b8e8c..10c675f 100644
3+
--- a/src/rust/Cargo.lock
4+
+++ b/src/rust/Cargo.lock
5+
@@ -406,8 +406,7 @@ dependencies = [
6+
[[package]]
7+
name = "pyo3"
8+
version = "0.15.2"
9+
-source = "registry+https://github.com/rust-lang/crates.io-index"
10+
-checksum = "d41d50a7271e08c7c8a54cd24af5d62f73ee3a6f6a314215281ebdec421d5752"
11+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
12+
dependencies = [
13+
"cfg-if",
14+
"indoc",
15+
@@ -422,8 +421,7 @@ dependencies = [
16+
[[package]]
17+
name = "pyo3-build-config"
18+
version = "0.15.2"
19+
-source = "registry+https://github.com/rust-lang/crates.io-index"
20+
-checksum = "779239fc40b8e18bc8416d3a37d280ca9b9fb04bda54b98037bb6748595c2410"
21+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
22+
dependencies = [
23+
"once_cell",
24+
]
25+
@@ -431,8 +429,7 @@ dependencies = [
26+
[[package]]
27+
name = "pyo3-macros"
28+
version = "0.15.2"
29+
-source = "registry+https://github.com/rust-lang/crates.io-index"
30+
-checksum = "00b247e8c664be87998d8628e86f282c25066165f1f8dda66100c48202fdb93a"
31+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
32+
dependencies = [
33+
"pyo3-macros-backend",
34+
"quote",
35+
@@ -442,8 +439,7 @@ dependencies = [
36+
[[package]]
37+
name = "pyo3-macros-backend"
38+
version = "0.15.2"
39+
-source = "registry+https://github.com/rust-lang/crates.io-index"
40+
-checksum = "5a8c2812c412e00e641d99eeb79dd478317d981d938aa60325dfa7157b607095"
41+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.15.2.graalpy#879575fc39d7378dec0e56ce4480b1ae5744c34f"
42+
dependencies = [
43+
"proc-macro2",
44+
"pyo3-build-config",
45+
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
46+
index d557fc0..147455c 100644
47+
--- a/src/rust/Cargo.toml
48+
+++ b/src/rust/Cargo.toml
49+
@@ -7,7 +7,7 @@ publish = false
50+
51+
[dependencies]
52+
once_cell = "1"
53+
-pyo3 = { version = "0.15.2" }
54+
+pyo3 = { git = "https://github.com/timfel/pyo3.git", branch = "v0.15.2.graalpy" }
55+
asn1 = { version = "0.13.0", default-features = false }
56+
pem = "1.1"
57+
chrono = { version = "0.4.22", default-features = false, features = ["alloc", "clock"] }
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
2+
index b2e0ac4..792c398 100644
3+
--- a/src/rust/Cargo.lock
4+
+++ b/src/rust/Cargo.lock
5+
@@ -274,9 +274,8 @@ dependencies = [
6+
7+
[[package]]
8+
name = "pyo3"
9+
-version = "0.20.2"
10+
-source = "registry+https://github.com/rust-lang/crates.io-index"
11+
-checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0"
12+
+version = "0.20.3"
13+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.20.3.graalpy#c02d58c5158dbb3a080200a078b0e997b83a7575"
14+
dependencies = [
15+
"cfg-if",
16+
"indoc",
17+
@@ -291,9 +290,8 @@ dependencies = [
18+
19+
[[package]]
20+
name = "pyo3-build-config"
21+
-version = "0.20.2"
22+
-source = "registry+https://github.com/rust-lang/crates.io-index"
23+
-checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be"
24+
+version = "0.20.3"
25+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.20.3.graalpy#c02d58c5158dbb3a080200a078b0e997b83a7575"
26+
dependencies = [
27+
"once_cell",
28+
"target-lexicon",
29+
@@ -301,9 +299,8 @@ dependencies = [
30+
31+
[[package]]
32+
name = "pyo3-ffi"
33+
-version = "0.20.2"
34+
-source = "registry+https://github.com/rust-lang/crates.io-index"
35+
-checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1"
36+
+version = "0.20.3"
37+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.20.3.graalpy#c02d58c5158dbb3a080200a078b0e997b83a7575"
38+
dependencies = [
39+
"libc",
40+
"pyo3-build-config",
41+
@@ -311,9 +308,8 @@ dependencies = [
42+
43+
[[package]]
44+
name = "pyo3-macros"
45+
-version = "0.20.2"
46+
-source = "registry+https://github.com/rust-lang/crates.io-index"
47+
-checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3"
48+
+version = "0.20.3"
49+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.20.3.graalpy#c02d58c5158dbb3a080200a078b0e997b83a7575"
50+
dependencies = [
51+
"proc-macro2",
52+
"pyo3-macros-backend",
53+
@@ -323,9 +319,8 @@ dependencies = [
54+
55+
[[package]]
56+
name = "pyo3-macros-backend"
57+
-version = "0.20.2"
58+
-source = "registry+https://github.com/rust-lang/crates.io-index"
59+
-checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f"
60+
+version = "0.20.3"
61+
+source = "git+https://github.com/timfel/pyo3.git?branch=v0.20.3.graalpy#c02d58c5158dbb3a080200a078b0e997b83a7575"
62+
dependencies = [
63+
"heck",
64+
"proc-macro2",
65+
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
66+
index 2322486..a0b5c8f 100644
67+
--- a/src/rust/Cargo.toml
68+
+++ b/src/rust/Cargo.toml
69+
@@ -10,7 +10,7 @@ rust-version = "1.63.0"
70+
[dependencies]
71+
once_cell = "1"
72+
cfg-if = "1"
73+
-pyo3 = { version = "0.20", features = ["abi3"] }
74+
+pyo3 = { git = "https://github.com/timfel/pyo3.git", branch = "v0.20.3.graalpy", features = ["abi3"] }
75+
asn1 = { version = "0.15.5", default-features = false }
76+
cryptography-cffi = { path = "cryptography-cffi" }
77+
cryptography-key-parsing = { path = "cryptography-key-parsing" }
78+
diff --git a/src/rust/cryptography-cffi/Cargo.toml b/src/rust/cryptography-cffi/Cargo.toml
79+
index a025e58..cff5fcf 100644
80+
--- a/src/rust/cryptography-cffi/Cargo.toml
81+
+++ b/src/rust/cryptography-cffi/Cargo.toml
82+
@@ -8,7 +8,7 @@ publish = false
83+
rust-version = "1.63.0"
84+
85+
[dependencies]
86+
-pyo3 = { version = "0.20", features = ["abi3"] }
87+
+pyo3 = { git = "https://github.com/timfel/pyo3.git", branch = "v0.20.3.graalpy", features = ["abi3"] }
88+
openssl-sys = "0.9.99"
89+
90+
[build-dependencies]

graalpython/lib-graalpython/patches/cryptography/metadata.toml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,28 @@ version = '== 3.4.7'
33
patch = 'cryptography-3.4.7.patch'
44

55
[[rules]]
6-
version = '== 39.0.2'
6+
version = '== 38.0.0'
7+
patch = 'cryptography-38.0.0.patch'
8+
9+
[[rules]]
10+
version = '>= 38.0.1, < 39.0.0'
11+
patch = 'cryptography-38.0.1.patch'
12+
13+
[[rules]]
14+
version = '>= 39.0.0, < 39.0.2'
15+
patch = 'cryptography-39.0.0.patch'
16+
17+
[[rules]]
18+
version = '>= 39.0.2, < 41.0.0'
719
patch = 'cryptography-39.0.2.patch'
820

921
[[rules]]
10-
version = '== 41.0.3'
11-
patch = 'cryptography-41.0.3.patch'
22+
version = '>= 41.0.0, < 42.0.0'
23+
patch = 'cryptography-41.0.0.patch'
24+
25+
[[rules]]
26+
version = '>= 42.0.0, < 42.0.5'
27+
patch = 'cryptography-42.0.0.patch'
1228

1329
[[rules]]
1430
version = '== 42.0.5'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[rules]]
2+
# 0.4.0 requires numpy==2.0rc1
3+
version = "< 0.4.0"

0 commit comments

Comments
 (0)