Skip to content

Commit 9b0a40d

Browse files
author
Release Manager
committed
gh-37646: Fix compilation with -std=c++17
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Fixes #36840. 0c96d61: I don't think there should be any issues with this, as it should be exactly what `cpdef` does under the hood. That being said, I'd like someone knowledgable with Cython to sanity check this. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> N/A URL: #37646 Reported by: Shorden Reviewer(s): Matthias Köppe, Shorden
2 parents cf58964 + 39db3c5 commit 9b0a40d

File tree

7 files changed

+26
-7
lines changed

7 files changed

+26
-7
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=25a360e4892317526249e50eaa51297891511d61
3-
md5=0fd34b91fc06199e6c3672ad969472ee
4-
cksum=1226224895
2+
sha1=461fc89608a23f5e06c75bdd0a7480527fc3fa66
3+
md5=94145a9c6e55496266631d06c3d7fdeb
4+
cksum=613494009
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d13f6164a314f330071fe2a99112e78de03347f0
1+
e9456b2da71c424d3ff188d5bb75e3c60f42be16

src/sage/modular/arithgroup/farey.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <sstream>
2525
#include <algorithm>
2626
#include <cassert>
27+
#include <functional>
2728

2829
#include <gmpxx.h>
2930
#include <Python.h>
@@ -737,7 +738,7 @@ size_t FareySymbol::nu3() const {
737738
size_t FareySymbol::rank_pi() const {
738739
if( index() == 2 ) return 1;
739740
return count_if(pairing.begin(), pairing.end(),
740-
bind2nd(greater<int>(), 0))/2;
741+
bind(greater<int>(), placeholders::_1, 0))/2;
741742
}
742743

743744
size_t FareySymbol::number_of_cusps() const {

src/sage/modular/arithgroup/farey_symbol.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# distutils: sources = sage/modular/arithgroup/sl2z.cpp sage/modular/arithgroup/farey.cpp
2+
# distutils: language = c++
3+
# distutils: extra_compile_args = -std=c++11
24
# sage.doctest: needs sage.libs.pari
35
r"""
46
Farey symbol for arithmetic subgroups of `\PSL_2(\ZZ)`

src/sage/rings/polynomial/hilbert.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ cdef inline list interred(list L) noexcept:
106106
# that appears later in L.
107107
if not L:
108108
return []
109-
L.sort(key=ETuple.unweighted_degree)
109+
L.sort(key=ETuple._unweighted_degree)
110110
cdef size_t i
111111
cdef ETuple m
112112
cdef list result = [<ETuple> PyList_GET_ITEM(L, 0)]

src/sage/rings/polynomial/polydict.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ cdef class ETuple:
1414
cdef ETuple _new(self) noexcept
1515
cdef int get_exp(self, size_t i) noexcept
1616

17+
# need a cdef version for function pointers
18+
cdef int _unweighted_degree(self) except *
1719
cpdef int unweighted_degree(self) except *
1820
cpdef int weighted_degree(self, tuple w) except *
1921
cpdef int unweighted_quotient_degree(self, ETuple other) except *

src/sage/rings/polynomial/polydict.pyx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ cdef class ETuple:
18451845

18461846
# additional methods
18471847

1848-
cpdef int unweighted_degree(self) except *:
1848+
cdef int _unweighted_degree(self) except *:
18491849
r"""
18501850
Return the sum of entries.
18511851
@@ -1863,6 +1863,20 @@ cdef class ETuple:
18631863
degree += self._data[2 * i + 1]
18641864
return degree
18651865

1866+
cpdef int unweighted_degree(self) except *:
1867+
r"""
1868+
Return the sum of entries.
1869+
1870+
EXAMPLES::
1871+
1872+
sage: from sage.rings.polynomial.polydict import ETuple
1873+
sage: ETuple([1, 1, 0, 2, 0]).unweighted_degree()
1874+
4
1875+
sage: ETuple([-1, 1]).unweighted_degree()
1876+
0
1877+
"""
1878+
return self._unweighted_degree()
1879+
18661880
@cython.boundscheck(False)
18671881
@cython.wraparound(False)
18681882
cpdef int weighted_degree(self, tuple w) except *:

0 commit comments

Comments
 (0)