summaryrefslogtreecommitdiff
path: root/dev-python/cython
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-06-16 01:40:03 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-06-16 01:40:03 +0100
commit98dd97c6dc5b5b4ad4bb19efeb7f314cc52f43ff (patch)
tree4e8e5247d2b6daea3cdd2839960281e1876613cb /dev-python/cython
parent3ba87279363a3a099c83d72faaf5b6bee1b23304 (diff)
gentoo auto-resync : 16:06:2023 - 01:40:03
Diffstat (limited to 'dev-python/cython')
-rw-r--r--dev-python/cython/Manifest3
-rw-r--r--dev-python/cython/cython-3.0.0_beta3-r2.ebuild (renamed from dev-python/cython/cython-3.0.0_beta3-r1.ebuild)3
-rw-r--r--dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch207
3 files changed, 212 insertions, 1 deletions
diff --git a/dev-python/cython/Manifest b/dev-python/cython/Manifest
index b0f28691ca69..152fd0434e7c 100644
--- a/dev-python/cython/Manifest
+++ b/dev-python/cython/Manifest
@@ -2,11 +2,12 @@ AUX 50cython-gentoo.el 388 BLAKE2B 5bc38190b467efa9e7be1a5831022534dbfdc02206fca
AUX cython-0.29.22-spawn-multiprocessing.patch 963 BLAKE2B ebbc3f6f4fa88e7e082326bccbad328724a4ff5645f0b2aa28f21419044b17bed8495618bb980b23a99310c2b6ef275331e1b9aa6d734017eb33646c92a07a73 SHA512 3f5c6b4108b87cf3014416386095c07ac91762152bbd87e8bd589177d40b933c11e19610bea06720c5c70f76b5b9b70d27e5c3cfa20eed30deaaf7d122910bd3
AUX cython-0.29.23-pythran-parallel-install.patch 874 BLAKE2B 39286ee98427260ce6ec077a750e0a1412445343fd11be9d96d8ab65b7d9789c5f1864cb9a1b3565ee3f51e117ecc854ebacc39dc32917fc72f36340c2d7f0a1 SHA512 8b78755288d3f165d962a5a1be9492d609a8e3dab10197b271c84ed0c4b7006053038e68f18bbb4204e6acba83e3f72ffeabf57ffa03f4a08f28b65db3cfd854
AUX cython-0.29.23-test_exceptions-py310.patch 656 BLAKE2B 6c650c85d01b8bf367528d144cd967fa9def94634e35763e2e7a1c3e5afa2b01d0c84694024dde6e45577eee223f6464b5f88ab971d207d35892edf347a0c08f SHA512 d8f7f770a0b3303552deec0e7d3f9258de1edcd384f4b2c3881634fd21ce847a3d974e9142d1ed2fbe3a549e65292c6690be3a36ab4de52d0593d9831dc2f7ce
+AUX cython-3.0.0_beta3-const-iter.patch 7842 BLAKE2B af1097e3f3b9f22f2ad5b8416eb057042f8892f830f4a8a547cd06860c84457c946f86674090dd64dba946ebae6e7e9bcc37783d1223e4b4b64fb6094fc29f31 SHA512 673d14a946107cc2514908760f6f038b436f11c6e76f006d5fc28b1729ba872ac12d05c6cc893aeef51c4c5538ada9958e9dc79f23a1777f2439e275fedb3e72
AUX cython-3.0.0_beta3-py312-long.patch 1397 BLAKE2B 194906e0df79df8c0b3e42d5c3c29200cf0277f38ea70aaa8cd654ccb1d3ce44c1ce63de3d12cb4939b5a3855afdbdea0995e5aecce118547dce6d7ce3ce9677 SHA512 692c4f9972b2d6fe50ca40f784cb9deb3ee7dc0dd73f6028996ee59ff50549d87cf930e126cb75629d31d057a794760cb00373f8ad56802dddb5aef0fea8ae2a
DIST cython-0.29.34.gh.tar.gz 2114639 BLAKE2B c5f70fd3e6074d9030a1035bc98d71b703e0f391b61bd91f3ffba2c35a29a98b9ff8ef2047e7c75743ead280f0f06a924abe84ae8bf7696b65da662a3c58ee0c SHA512 51679d1304d0f87dfb51e60c753f1ce60027f855a91cf130a5dcf84353884a7dcf09c01701945ae2f9173f8f095890c377d5faac28c2f01d7f764609c0130411
DIST cython-0.29.35.gh.tar.gz 2115190 BLAKE2B ac23abbd2b560ee52a79840d995a4cf36ddb3a8705b9327010f1ad6add8028185c15703efcc1d59b581d65b5de38e123c0f07c36fe6ffe54a6efee7512161344 SHA512 35d679d94e1f731e004b83fb4ae0d569703b0800c913012308146b1c54463ce12cb1cf3733e24162fb357f179444c5ca31108a37850e6c749ddebac5175119f5
DIST cython-3.0.0b3.gh.tar.gz 2688784 BLAKE2B 933bb48b2bf5169c973a36c877a36eae28b80409a7ff395b82a14ac0740247496df3c9f2d69884c823b7475069f0c75d6cbbb964b88de60b38082e6e36659bff SHA512 f1d0fdcec4bc6b0f6cb66078592424fdcb7a028b79c5b9d41280ae112235736d11c9f4f793e810007e880ae0def195ac25999db59065c7f7bdcfab84b06bf7d3
EBUILD cython-0.29.34.ebuild 2053 BLAKE2B 23381f1aef8140eb5becd09cb5f39563d8d801665b7fb6f8674658d7c5923855c9124dc88c10b0bc024b5b8771a1ed25faa938b7380dbb556b84d10a34b9a081 SHA512 7dd4ea66bdcb44dc64be8d617eac48bf4f80a32db5c8e2423a94c2c7ebef2857f1a103f07f32e6281d0fc84f4d78e27e8582006bebfc4cb7deae1f1b8c1eb333
EBUILD cython-0.29.35.ebuild 2235 BLAKE2B 13745707385029f734c4e5ef115d80965548103da98a867b20a7af3e8a3aeaf47406867e7e53c36e15b7c44076da4aed28995a80066a968c7d7666894a02e4ba SHA512 8204257523286aeed590d89bea235431c9b7ccb00bb05422799213b58a56ae050d31c87f160960f8f6a5b79ea61f92c4d452714c9d804e6d770e387e283db33e
-EBUILD cython-3.0.0_beta3-r1.ebuild 1997 BLAKE2B 1df3eaa28c3d4194c639bd39a7a4fe3c28b19173ee1407d6326d0851f7a63473fb7713eeea743adb6b3b5fbe27ce8a119a6242c35747d4635bf2de79cc9a3a70 SHA512 312edd66a8b4d020835e9f4f751f48f3e8000ebfeddeff2b7b5e804f8f7b890038e4ac270df55a5717a5421034b3bca16613cfcb3e969e9544a947b5af5ddd26
+EBUILD cython-3.0.0_beta3-r2.ebuild 2115 BLAKE2B 0cacc31bd5d8bd48abaa04d2e218a5d2c6649bef1245b2df20d2d37791120482c7a7db7e18870a5d4494f6170fc04396ec5652bfde2c9cd6242c4a24f6ff7957 SHA512 1ceb34f826a96112cb97f2ba203d49db5f99680155755844f72af0b9d3efd9d1399c3dd9d839e6f1cc4f4c040fa048513ae1a0fc12fb01f37057a38d21257dda
MISC metadata.xml 606 BLAKE2B 1ee3fc75852383aa0618afeb7521c3ae0e95b518c85b2c58ff958905092cf68017d313a09d25031a50b649f9dd1b452e751036f2552df9d91447baaeff0a8f0b SHA512 b7917c2e417cee9e59c8011246f7223f5095c87f0294ea140dbfc8fda0b09cf61c9f055380a9d3f74a07e71bb49d75f219d6224ea95f1f4d4b451e5688c13f78
diff --git a/dev-python/cython/cython-3.0.0_beta3-r1.ebuild b/dev-python/cython/cython-3.0.0_beta3-r2.ebuild
index ca84314058cc..bbe34ee3f715 100644
--- a/dev-python/cython/cython-3.0.0_beta3-r1.ebuild
+++ b/dev-python/cython/cython-3.0.0_beta3-r2.ebuild
@@ -45,6 +45,9 @@ PATCHES=(
"${FILESDIR}/${PN}-0.29.23-pythran-parallel-install.patch"
# backport upstream fix e.g. for dev-python/pysimdjson on py3.12
"${FILESDIR}/${P}-py312-long.patch"
+ # should fix dev-python/symengine
+ # https://github.com/cython/cython/pull/5483
+ "${FILESDIR}/${P}-const-iter.patch"
)
distutils_enable_sphinx docs \
diff --git a/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch b/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch
new file mode 100644
index 000000000000..18822f12904a
--- /dev/null
+++ b/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch
@@ -0,0 +1,207 @@
+From 913b8fadc5fc45306764c0ede472e1bc3b606d10 Mon Sep 17 00:00:00 2001
+From: Isuru Fernando <isuruf@gmail.com>
+Date: Mon, 12 Jun 2023 13:42:09 -0500
+Subject: [PATCH 1/4] Don't remove const for reverse iteration
+
+---
+ Cython/Compiler/ExprNodes.py | 27 ---------------------------
+ Cython/Includes/libcpp/map.pxd | 8 ++++++--
+ 2 files changed, 6 insertions(+), 29 deletions(-)
+
+diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
+index ad4701b7bb6..275a6233da5 100644
+--- a/Cython/Compiler/ExprNodes.py
++++ b/Cython/Compiler/ExprNodes.py
+@@ -3268,32 +3268,6 @@ def free_temps(self, code):
+ ExprNode.free_temps(self, code)
+
+
+-def remove_const(item_type):
+- """
+- Removes the constness of a given type and its underlying templates
+- if any.
+-
+- This is to solve the compilation error when the temporary variable used to
+- store the result of an iterator cannot be changed due to its constness.
+- For example, the value_type of std::map, which will also be the type of
+- the temporarry variable, is std::pair<const Key, T>. This means the first
+- component of the variable cannot be reused to store the result of each
+- iteration, which leads to a compilation error.
+- """
+- if item_type.is_const:
+- item_type = item_type.cv_base_type
+- if item_type.is_typedef:
+- item_type = remove_const(item_type.typedef_base_type)
+- if item_type.is_cpp_class and item_type.templates:
+- templates = [remove_const(t) if t.is_const else t for t in item_type.templates]
+- template_type = item_type.template_type
+- item_type = PyrexTypes.CppClassType(
+- template_type.name, template_type.scope,
+- template_type.cname, template_type.base_classes,
+- templates, template_type)
+- return item_type
+-
+-
+ class NextNode(AtomicExprNode):
+ # Used as part of for statement implementation.
+ # Implements result = next(iterator)
+@@ -3336,7 +3310,6 @@ def infer_type(self, env, iterator_type=None):
+
+ def analyse_types(self, env):
+ self.type = self.infer_type(env, self.iterator.type)
+- self.type = remove_const(self.type)
+ self.is_temp = 1
+ return self
+
+diff --git a/Cython/Includes/libcpp/map.pxd b/Cython/Includes/libcpp/map.pxd
+index d81af66e09a..2c2c5c82adf 100644
+--- a/Cython/Includes/libcpp/map.pxd
++++ b/Cython/Includes/libcpp/map.pxd
+@@ -50,7 +50,9 @@ cdef extern from "<map>" namespace "std" nogil:
+ cppclass reverse_iterator:
+ reverse_iterator() except +
+ reverse_iterator(reverse_iterator&) except +
+- value_type& operator*()
++ # correct would be value_type& but this does not work
++ # well with cython's code gen
++ pair[T, U]& operator*()
+ reverse_iterator operator++()
+ reverse_iterator operator--()
+ reverse_iterator operator++(int)
+@@ -63,7 +65,9 @@ cdef extern from "<map>" namespace "std" nogil:
+ const_reverse_iterator() except +
+ const_reverse_iterator(reverse_iterator&) except +
+ operator=(reverse_iterator&) except +
+- const value_type& operator*()
++ # correct would be const value_type& but this does not work
++ # well with cython's code gen
++ const pair[T, U]& operator*()
+ const_reverse_iterator operator++()
+ const_reverse_iterator operator--()
+ const_reverse_iterator operator++(int)
+
+From cb804f989eaa9938e72d0336d82bb7aa0003455f Mon Sep 17 00:00:00 2001
+From: Isuru Fernando <isuruf@gmail.com>
+Date: Mon, 12 Jun 2023 13:57:58 -0500
+Subject: [PATCH 2/4] Add test from gh5478
+
+---
+ tests/run/cpp_iterators.pyx | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/tests/run/cpp_iterators.pyx b/tests/run/cpp_iterators.pyx
+index 81048d0b36b..424168fa825 100644
+--- a/tests/run/cpp_iterators.pyx
++++ b/tests/run/cpp_iterators.pyx
+@@ -7,6 +7,7 @@ from libcpp.map cimport map as stdmap
+ from libcpp.set cimport set as stdset
+ from libcpp.string cimport string
+ from libcpp.vector cimport vector
++from libcpp.memory cimport shared_ptr, make_shared
+ from cython.operator cimport dereference as deref
+
+ cdef extern from "cpp_iterators_simple.h":
+@@ -272,6 +273,27 @@ def test_iteration_over_attribute_of_call():
+ for i in get_object_with_iterable_attribute().vec:
+ print(i)
+
++cdef extern from *:
++ # TODO: support make_shared[const int]
++ shared_ptr[const int] make_shared_const_int "std::make_shared<const int>"(int)
++
++def test_iteration_over_shared_const_ptr_set(py_v):
++ """
++ >>> test_iteration_over_shared_const_ptr_set[2, 4, 6])
++ 6
++ 4
++ 2
++ """
++ cdef stdset[shared_ptr[const int]] s
++ cdef int i
++ for e in py_v:
++ i = e
++ s.insert(make_shared_const_int(i))
++
++ cdef shared_ptr[const int] a
++ for a in s:
++ print(deref(a))
++
+ def test_iteration_over_reversed_list(py_v):
+ """
+ >>> test_iteration_over_reversed_list([2, 4, 6])
+
+From a9bfacdcf5358e9d5a1d3c8ab0dd2eff6f18018a Mon Sep 17 00:00:00 2001
+From: Isuru Fernando <isuruf@gmail.com>
+Date: Mon, 12 Jun 2023 14:07:37 -0500
+Subject: [PATCH 3/4] Fix multimap too
+
+---
+ Cython/Includes/libcpp/map.pxd | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/Cython/Includes/libcpp/map.pxd b/Cython/Includes/libcpp/map.pxd
+index 2c2c5c82adf..eb739509ac1 100644
+--- a/Cython/Includes/libcpp/map.pxd
++++ b/Cython/Includes/libcpp/map.pxd
+@@ -177,7 +177,9 @@ cdef extern from "<map>" namespace "std" nogil:
+ cppclass reverse_iterator:
+ reverse_iterator() except +
+ reverse_iterator(reverse_iterator&) except +
+- value_type& operator*()
++ # correct would be value_type& but this does not work
++ # well with cython's code gen
++ pair[T, U]& operator*()
+ reverse_iterator operator++()
+ reverse_iterator operator--()
+ reverse_iterator operator++(int)
+@@ -190,7 +192,9 @@ cdef extern from "<map>" namespace "std" nogil:
+ const_reverse_iterator() except +
+ const_reverse_iterator(reverse_iterator&) except +
+ operator=(reverse_iterator&) except +
+- const value_type& operator*()
++ # correct would be const value_type& but this does not work
++ # well with cython's code gen
++ const pair[T, U]& operator*()
+ const_reverse_iterator operator++()
+ const_reverse_iterator operator--()
+ const_reverse_iterator operator++(int)
+
+From 0528cd937e6d4606eb0902ee8d8db672ee7f88fe Mon Sep 17 00:00:00 2001
+From: Isuru Fernando <isuruf@gmail.com>
+Date: Mon, 12 Jun 2023 17:50:41 -0500
+Subject: [PATCH 4/4] Fix test
+
+---
+ tests/run/cpp_iterators.pyx | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/tests/run/cpp_iterators.pyx b/tests/run/cpp_iterators.pyx
+index 424168fa825..57d2716bea5 100644
+--- a/tests/run/cpp_iterators.pyx
++++ b/tests/run/cpp_iterators.pyx
+@@ -277,18 +277,17 @@ cdef extern from *:
+ # TODO: support make_shared[const int]
+ shared_ptr[const int] make_shared_const_int "std::make_shared<const int>"(int)
+
+-def test_iteration_over_shared_const_ptr_set(py_v):
++def test_iteration_over_shared_const_ptr_vector(py_v):
+ """
+- >>> test_iteration_over_shared_const_ptr_set[2, 4, 6])
+- 6
+- 4
++ >>> test_iteration_over_shared_const_ptr_vector([2, 4, 6])
+ 2
++ 4
++ 6
+ """
+- cdef stdset[shared_ptr[const int]] s
++ cdef vector[shared_ptr[const int]] s
+ cdef int i
+- for e in py_v:
+- i = e
+- s.insert(make_shared_const_int(i))
++ for i in py_v:
++ s.push_back(make_shared_const_int(i))
+
+ cdef shared_ptr[const int] a
+ for a in s: