#18329 closed enhancement (fixed)
Inherit __richcmp__ and __cmp__ in subclasses of Element
Reported by:  Jeroen Demeyer  Owned by:  

Priority:  major  Milestone:  sage6.7 
Component:  coercion  Keywords:  
Cc:  JeanPierre Flori  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  JeanPierre Flori 
Report Upstream:  Fixed upstream, but not in a stable release.  Work issues:  
Branch:  f6058e7 (Commits, GitHub, GitLab)  Commit:  
Dependencies:  Stopgaps: 
Description (last modified by )
Use the __typeinit__
mechanism introduced by #18330 to inherit __cmp__
and __richcmp__
even if those would not be inherited by default.
Upstream patch added: https://github.com/cython/cython/pull/383
Change History (50)
comment:1 Changed 7 years ago by
Branch:  → u/jdemeyer/inherit_richcompare 

comment:2 Changed 7 years ago by
Commit:  → 3bb7361e82b304d4e81d73ad1372670bf2a9da4c 

Dependencies:  → #17890, #18321, #18322, #18330 
comment:3 Changed 7 years ago by
Branch:  u/jdemeyer/inherit_richcompare 

Commit:  3bb7361e82b304d4e81d73ad1372670bf2a9da4c 
Dependencies:  #17890, #18321, #18322, #18330 → #18321, #18322, #18330 
Description:  modified (diff) 
comment:4 Changed 7 years ago by
Branch:  → u/jdemeyer/ticket/18329 

comment:5 Changed 7 years ago by
Commit:  → db60d48c222c6b946a1d911dd6ca071b9072630d 

Dependencies:  #18321, #18322, #18330 → #18321, #18322, #18330, #18380 
New commits:
5d4b11e  Don't cimport "type"

bb98fd0  _cmp should try _richcmp_ if _cmp_ failed

30fe462  Cython metaclass support

d4ba872  Add check for tp_basicsize

3ec2842  Revert changes to coerce_dict

2698d89  Merge commit '5d4b11e4ed2b4053290386b87f666c88bb606782'; commit 'bb98fd07ee04b18a4ec329aeb2bf061dab4f7d6d'; commit '3ec2842529f4aa7763b2db0a7c6556c5bb437c14' into ticket/18329

db60d48  Meteclass for inheriting comparison functions

comment:6 Changed 7 years ago by
Commit:  db60d48c222c6b946a1d911dd6ca071b9072630d → 4073a17b52812ca5080fd2762757ef21c7247f5c 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
4073a17  Meteclass for inheriting comparison functions

comment:7 Changed 7 years ago by
Commit:  4073a17b52812ca5080fd2762757ef21c7247f5c → 3481133dd3060ebeb7786838e946a406d460f8f8 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
8f60acb  Add class CombinatorialElement

d826520  Use LazyFormat for _cmp_ exception

ac9ca1c  Update comment

6e6870b  Add some needed casts

bc4d957  Remove TypeInitMetaclass, add some documentation

70908cb  Comment

19f3337  Merge commit '5d4b11e4ed2b4053290386b87f666c88bb606782'; commit 'ac9ca1c83737253b380a79cde33b4908a51d0ead'; commit '70908cbbaa5b4ec6c6f5dc7332d0f7c1379b511e' into HEAD

3481133  Metaclass for inheriting comparison functions

comment:8 Changed 7 years ago by
Commit:  3481133dd3060ebeb7786838e946a406d460f8f8 → 6c712ef6a941721e02054fa7d33c73047abe9839 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
6c712ef  Metaclass for inheriting comparison functions

comment:9 Changed 7 years ago by
Dependencies:  #18321, #18322, #18330, #18380 → #18321, #18322, #18330, #18380, #18387 

comment:10 Changed 7 years ago by
Almost there :)
 sage t src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py # 693 doctests failed sage t src/sage/combinat/root_system/root_lattice_realizations.py # 1 doctest failed sage t src/sage/graphs/generic_graph.py # 2 doctests failed sage t src/sage/modular/modform_hecketriangle/readme.py # 364 doctests failed sage t src/sage/modular/modform_hecketriangle/abstract_space.py # 558 doctests failed sage t src/sage/combinat/k_tableau.py # 27 doctests failed sage t src/sage/modular/modform_hecketriangle/graded_ring_element.py # 593 doctests failed sage t src/sage/combinat/designs/database.py # 6 doctests failed sage t src/sage/combinat/skew_tableau.py # 14 doctests failed sage t src/sage/geometry/polyhedron/base.py # 1 doctest failed sage t src/sage/combinat/partition.py # 22 doctests failed sage t src/sage/schemes/projective/projective_morphism.py # 4 doctests failed sage t src/sage/schemes/elliptic_curves/isogeny_small_degree.py # 2 doctests failed sage t src/sage/modular/modform/element.py # 23 doctests failed sage t src/sage/combinat/ncsf_qsym/ncsf.py # 7 doctests failed sage t src/sage/schemes/toric/chow_group.py # 3 doctests failed sage t src/sage/algebras/steenrod/steenrod_algebra.py # 7 doctests failed sage t src/sage/modular/abvar/abvar.py # 6 doctests failed sage t src/sage/combinat/sf/sfa.py # 1 doctest failed sage t src/sage/combinat/set_partition.py # 5 doctests failed sage t src/sage/modular/local_comp/type_space.py # 50 doctests failed sage t src/sage/combinat/posets/posets.py # 53 doctests failed sage t src/sage/combinat/root_system/weight_space.py # 3 doctests failed sage t src/sage/combinat/sf/k_dual.py # 3 doctests failed sage t src/sage/modular/abvar/homspace.py # 1 doctest failed sage t src/sage/matrix/matrix2.pyx # 5 doctests failed sage t src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py # 224 doctests failed sage t src/sage/schemes/toric/variety.py # 2 doctests failed sage t src/sage/categories/semigroups.py # 1 doctest failed sage t src/sage/algebras/iwahori_hecke_algebra.py # 2 doctests failed sage t src/sage/schemes/elliptic_curves/ell_point.py # 70 doctests failed sage t src/sage/modular/hecke/submodule.py # 2 doctests failed sage t src/sage/doctest/forker.py # 1 doctest failed sage t src/sage/modular/local_comp/local_comp.py # 43 doctests failed sage t src/sage/combinat/ncsym/ncsym.py # 7 doctests failed sage t src/sage/categories/pushout.py # 3 doctests failed sage t src/sage/modules/free_module_element.pyx # 4 doctests failed sage t src/sage/combinat/ncsf_qsym/qsym.py # 4 doctests failed sage t src/sage/combinat/rigged_configurations/kr_tableaux.py # 9 doctests failed sage t src/sage/schemes/elliptic_curves/ell_curve_isogeny.py # 4 doctests failed sage t src/sage/modular/modform_hecketriangle/subspace.py # 100 doctests failed sage t src/sage/combinat/tableau_tuple.py # 34 doctests failed sage t src/sage/schemes/toric/morphism.py # 1 doctest failed sage t src/sage/combinat/descent_algebra.py # 4 doctests failed sage t src/sage/combinat/tableau.py # 23 doctests failed sage t src/sage/combinat/crystals/affine_factorization.py # 1 doctest failed sage t src/sage/modular/modform_hecketriangle/space.py # 203 doctests failed sage t src/sage/rings/polynomial/polynomial_element.pyx # 21 doctests failed sage t src/sage/combinat/designs/orthogonal_arrays_build_recursive.py # 12 doctests failed sage t src/sage/coding/linear_code.py # 20 doctests failed sage t src/sage/combinat/permutation.py # 26 doctests failed sage t src/sage/tests/french_book/numbertheory.py # 1 doctest failed sage t src/sage/algebras/hall_algebra.py # 4 doctests failed sage t src/sage/structure/parent.pyx # 5 doctests failed sage t src/sage/geometry/hyperplane_arrangement/arrangement.py # 3 doctests failed sage t src/sage/categories/finite_dimensional_algebras_with_basis.py # 7 doctests failed sage t src/sage/modular/modsym/ambient.py # 9 doctests failed sage t src/sage/combinat/root_system/integrable_representations.py # 1 doctest failed sage t src/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py # 34 doctests failed sage t src/sage/combinat/crystals/kirillov_reshetikhin.py # 2 doctests failed sage t src/sage/combinat/sf/new_kschur.py # 4 doctests failed sage t src/sage/combinat/symmetric_group_algebra.py # 7 doctests failed sage t src/sage/combinat/crystals/littelmann_path.py # 2 doctests failed sage t src/sage/combinat/root_system/type_relabel.py # 2 doctests failed sage t src/sage/combinat/root_system/ambient_space.py # 1 doctest failed sage t src/sage/combinat/skew_partition.py # 7 doctests failed sage t src/sage/combinat/root_system/type_affine.py # 3 doctests failed sage t src/sage/categories/coxeter_groups.py # 1 doctest failed sage t src/sage/combinat/rigged_configurations/rigged_configuration_element.py # 7 doctests failed sage t src/sage/combinat/quickref.py # 1 doctest failed sage t src/sage/combinat/sf/jack.py # 7 doctests failed sage t src/sage/combinat/partition_tuple.py # 7 doctests failed sage t src/sage/combinat/designs/difference_family.py # 5 doctests failed sage t src/sage/groups/matrix_gps/finitely_generated.py # 1 doctest failed sage t src/sage/modular/local_comp/smoothchar.py # 8 doctests failed sage t src/sage/combinat/root_system/type_marked.py # 2 doctests failed sage t src/sage/schemes/elliptic_curves/ell_generic.py # 8 doctests failed sage t src/sage/geometry/triangulation/point_configuration.py # 1 doctest failed sage t src/sage/combinat/sf/macdonald.py # 3 doctests failed sage t src/sage/combinat/yang_baxter_graph.py # 1 doctest failed sage t src/sage/groups/matrix_gps/linear.py # 1 doctest failed sage t src/sage/combinat/alternating_sign_matrix.py # 3 doctests failed sage t src/sage/combinat/root_system/weyl_characters.py # 3 doctests failed sage t src/sage/algebras/nil_coxeter_algebra.py # 2 doctests failed sage t src/sage/combinat/rigged_configurations/rigged_configurations.py # 3 doctests failed sage t src/sage/schemes/elliptic_curves/ell_finite_field.py # 23 doctests failed sage t src/sage/combinat/root_system/associahedron.py # 1 doctest failed sage t src/sage/modular/modform_hecketriangle/abstract_ring.py # 513 doctests failed sage t src/sage/modular/modform_hecketriangle/element.py # 72 doctests failed sage t src/sage/schemes/generic/algebraic_scheme.py # 2 doctests failed sage t src/sage/combinat/rigged_configurations/kleber_tree.py # 1 doctest failed sage t src/sage/geometry/fan_morphism.py # 2 doctests failed sage t src/sage/matrix/matrix_mod2e_dense.pyx # 2 doctests failed sage t src/sage/combinat/binary_tree.py # 15 doctests failed sage t src/sage/geometry/toric_lattice.py # 2 doctests failed sage t src/sage/modular/quatalg/brandt.py # 2 doctests failed sage t src/sage/coding/code_constructions.py # 57 doctests failed sage t src/sage/coding/codecan/autgroup_can_label.pyx # 45 doctests failed sage t src/sage/categories/primer.py # 1 doctest failed sage t src/sage/combinat/sf/sf.py # 1 doctest failed sage t src/sage/modular/hecke/ambient_module.py # 1 doctest failed sage t src/sage/combinat/affine_permutation.py # 3 doctests failed sage t src/sage/modular/hecke/module.py # 7 doctests failed sage t src/sage/categories/map.pyx # 4 doctests failed sage t src/sage/combinat/crystals/tensor_product.py # 11 doctests failed sage t src/sage/doctest/control.py # 1 doctest failed sage t src/sage/combinat/perfect_matching.py # 5 doctests failed sage t src/sage/combinat/integer_vectors_mod_permgroup.py # 6 doctests failed sage t src/sage/combinat/root_system/root_space.py # 1 doctest failed sage t src/sage/combinat/sf/schur.py # 2 doctests failed sage t src/sage/algebras/commutative_dga.py # 389 doctests failed sage t src/sage/combinat/sf/hall_littlewood.py # 2 doctests failed sage t src/sage/combinat/crystals/alcove_path.py # 3 doctests failed sage t src/sage/sets/set_from_iterator.py # 1 doctest failed sage t src/sage/geometry/hyperbolic_space/hyperbolic_point.py # 1 doctest failed sage t src/doc/en/thematic_tutorials/coding_theory.rst # 19 doctests failed sage t src/sage/combinat/root_system/root_system.py # 6 doctests failed sage t src/sage/modular/abvar/abvar_newform.py # 1 doctest failed sage t src/sage/quivers/representation.py # 7 doctests failed sage t src/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py # 1 doctest failed sage t src/sage/rings/algebraic_closure_finite_field.py # 54 doctests failed sage t src/sage/combinat/crystals/generalized_young_walls.py # 2 doctests failed sage t src/sage/combinat/diagram_algebras.py # 5 doctests failed sage t src/sage/rings/polynomial/multi_polynomial_libsingular.pyx # 2 doctests failed sage t src/sage/combinat/ncsf_qsym/generic_basis_code.py # 1 doctest failed sage t src/sage/misc/c3_controlled.pyx # 9 doctests failed sage t src/sage/modular/modsym/subspace.py # 2 doctests failed sage t src/sage/modular/modform/cuspidal_submodule.py # 1 doctest failed sage t src/sage/combinat/rigged_configurations/rc_infinity.py # 3 doctests failed sage t src/sage/rings/finite_rings/integer_mod_ring.py # 1 doctest failed sage t src/sage/algebras/schur_algebra.py # 2 doctests failed sage t src/sage/categories/homset.py # 2 doctests failed sage t src/sage/modular/abvar/finite_subgroup.py # 2 doctests failed sage t src/sage/algebras/free_algebra.py # 10 doctests failed sage t src/sage/combinat/ncsym/dual.py # 2 doctests failed sage t src/sage/monoids/automatic_semigroup.py # 17 doctests failed sage t src/sage/groups/abelian_gps/abelian_group.py # 1 doctest failed sage t src/sage/rings/polynomial/polynomial_quotient_ring.py # 6 doctests failed sage t src/sage/geometry/hyperbolic_space/hyperbolic_model.py # 8 doctests failed sage t src/sage/combinat/composition_tableau.py # 6 doctests failed sage t src/sage/tensor/modules/free_module_tensor.py # 2 doctests failed sage t src/doc/en/thematic_tutorials/algebraic_combinatorics/tsetlin_library.rst # 11 doctests failed sage t src/sage/coding/codecan/codecan.pyx # 33 doctests failed sage t src/sage/combinat/dyck_word.py # 15 doctests failed sage t src/sage/schemes/elliptic_curves/ell_field.py # 9 doctests failed sage t src/sage/modular/modsym/boundary.py # 5 doctests failed sage t src/sage/categories/highest_weight_crystals.py # 1 doctest failed sage t src/sage/modular/abvar/homology.py # 6 doctests failed sage t src/sage/combinat/crystals/monomial_crystals.py # 3 doctests failed sage t src/sage/combinat/free_module.py # 5 doctests failed sage t src/sage/combinat/sf/witt.py # 2 doctests failed sage t src/sage/combinat/set_partition_ordered.py # 3 doctests failed sage t src/sage/groups/generic.py # 8 doctests failed sage t src/sage/modular/abvar/cuspidal_subgroup.py # 2 doctests failed sage t src/sage/schemes/projective/endPN_automorphism_group.py # 12 doctests failed sage t src/sage/algebras/affine_nil_temperley_lieb.py # 1 doctest failed sage t src/sage/combinat/sf/orthotriang.py # 1 doctest failed sage t src/sage/modular/hecke/hecke_operator.py # 1 doctest failed sage t src/sage/rings/finite_rings/finite_field_base.pyx # 17 doctests failed sage t src/sage/combinat/ribbon_tableau.py # 7 doctests failed sage t src/sage/combinat/derangements.py # 4 doctests failed sage t src/sage/combinat/six_vertex_model.py # 2 doctests failed sage t src/sage/geometry/hyperplane_arrangement/hyperplane.py # 1 doctest failed sage t src/sage/categories/classical_crystals.py # 3 doctests failed sage t src/sage/combinat/posets/poset_examples.py # 1 doctest failed sage t src/sage/combinat/crystals/fast_crystals.py # 6 doctests failed sage t src/sage/categories/examples/with_realizations.py # 4 doctests failed sage t src/sage/modular/modform_hecketriangle/functors.py # 121 doctests failed sage t src/sage/matrix/matrix0.pyx # 1 doctest failed sage t src/sage/sets/disjoint_union_enumerated_sets.py # 6 doctests failed sage t src/sage/categories/sets_cat.py # 1 doctest failed sage t src/sage/combinat/gelfand_tsetlin_patterns.py # 6 doctests failed sage t src/sage/combinat/composition.py # 6 doctests failed sage t src/sage/modules/fg_pid/fgp_morphism.py # 3 doctests failed sage t src/sage/combinat/ribbon_shaped_tableau.py # 5 doctests failed sage t src/sage/rings/finite_rings/conway_polynomials.py # 17 doctests failed sage t src/sage/combinat/ordered_tree.py # 3 doctests failed sage t src/sage/categories/crystals.py # 1 doctest failed sage t src/sage/groups/perm_gps/symgp_conjugacy_class.py # 4 doctests failed sage t src/sage/schemes/plane_conics/con_field.py # 1 doctest failed sage t src/sage/rings/polynomial/polynomial_ring.py # 1 doctest failed sage t src/sage/homology/chain_complex.py # 2 doctests failed sage t src/sage/combinat/root_system/type_F.py # 1 doctest failed sage t src/sage/rings/universal_cyclotomic_field/universal_cyclotomic_field.py # 2 doctests failed sage t src/sage/rings/morphism.pyx # 19 doctests failed sage t src/sage/categories/modules_with_basis.py # 2 doctests failed sage t src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py # 1 doctest failed sage t src/sage/rings/polynomial/multi_polynomial.pyx # 7 doctests failed sage t src/sage/algebras/clifford_algebra.py # 3 doctests failed sage t src/sage/tensor/modules/tensor_with_indices.py # 1 doctest failed sage t src/sage/tests/french_book/linalg_doctest.py # 1 doctest failed sage t src/sage/combinat/sf/classical.py # 5 doctests failed sage t src/sage/combinat/abstract_tree.py # 2 doctests failed sage t src/sage/combinat/symmetric_group_representations.py # 6 doctests failed sage t src/sage/combinat/root_system/type_G.py # 1 doctest failed sage t src/sage/combinat/sf/dual.py # 1 doctest failed sage t src/sage/schemes/plane_conics/con_finite_field.py # 1 doctest failed sage t src/sage/combinat/similarity_class_type.py # 4 doctests failed sage t src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py # 4 doctests failed sage t src/sage/categories/examples/finite_weyl_groups.py # 1 doctest failed sage t src/sage/quivers/path_semigroup.py # 2 doctests failed sage t src/sage/sets/set.py # 1 doctest failed sage t src/sage/schemes/projective/projective_space.py # 1 doctest failed sage t src/sage/groups/additive_abelian/additive_abelian_group.py # 1 doctest failed sage t src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/l_series.rst # 3 doctests failed sage t src/sage/rings/quotient_ring.py # 1 doctest failed sage t src/sage/modular/modform_hecketriangle/constructor.py # 35 doctests failed sage t src/sage/categories/magmas.py # 1 doctest failed sage t src/sage/geometry/linear_expression.py # 3 doctests failed sage t src/sage/schemes/affine/affine_space.py # 1 doctest failed sage t src/sage/combinat/crystals/elementary_crystals.py # 4 doctests failed sage t src/sage/combinat/root_system/type_A.py # 1 doctest failed sage t src/sage/rings/finite_rings/hom_finite_field.pyx # 37 doctests failed sage t src/sage/combinat/sf/monomial.py # 2 doctests failed sage t src/sage/algebras/shuffle_algebra.py # 2 doctests failed sage t src/sage/geometry/polyhedron/backend_field.py # 2 doctests failed sage t src/sage/rings/finite_rings/element_pari_ffelt.pyx # 11 doctests failed sage t src/sage/misc/sage_unittest.py # 1 doctest failed sage t src/sage/schemes/projective/projective_homset.py # 1 doctest failed sage t src/sage/combinat/root_system/type_C.py # 1 doctest failed sage t src/sage/combinat/rigged_configurations/bij_type_B.py # 2 doctests failed sage t src/sage/combinat/core.py # 3 doctests failed sage t src/sage/categories/finite_posets.py # 46 doctests failed sage t src/sage/rings/polynomial/polynomial_quotient_ring_element.py # 1 doctest failed sage t src/sage/combinat/sf/powersum.py # 2 doctests failed sage t src/sage/modular/ssmod/ssmod.py # 12 doctests failed sage t src/sage/rings/finite_rings/element_ext_pari.py # 6 doctests failed sage t src/sage/categories/examples/semigroups.py # 6 doctests failed sage t src/sage/categories/examples/finite_semigroups.py # 2 doctests failed sage t src/sage/combinat/posets/incidence_algebras.py # 10 doctests failed sage t src/sage/rings/multi_power_series_ring.py # 7 doctests failed sage t src/sage/schemes/generic/homset.py # 4 doctests failed sage t src/doc/en/thematic_tutorials/coercion_and_categories.rst # 4 doctests failed sage t src/sage/rings/number_field/class_group.py # 1 doctest failed sage t src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx # 2 doctests failed sage t src/sage/categories/functor.pyx # 5 doctests failed sage t src/sage/combinat/rigged_configurations/bij_type_D_twisted.py # 2 doctests failed sage t src/sage/rings/finite_rings/constructor.py # 5 doctests failed sage t src/sage/categories/hopf_algebras_with_basis.py # 2 doctests failed sage t src/sage/combinat/integer_list.py # 1 doctest failed sage t src/sage/rings/power_series_ring.py # 3 doctests failed sage t src/sage/modular/modform_hecketriangle/graded_ring.py # 68 doctests failed sage t src/sage/rings/finite_rings/finite_field_givaro.py # 3 doctests failed sage t src/sage/rings/finite_rings/finite_field_pari_ffelt.py # 17 doctests failed sage t src/sage/misc/dev_tools.py # 1 doctest failed sage t src/sage/modular/hecke/element.py # 2 doctests failed sage t src/sage/sets/finite_set_maps.py # 16 doctests failed sage t src/sage/quivers/homspace.py # 1 doctest failed sage t src/sage/modular/modsym/manin_symbol_list.py # 1 doctest failed sage t src/sage/combinat/rigged_configurations/bij_abstract_class.py # 2 doctests failed sage t src/sage/rings/finite_rings/finite_field_ntl_gf2e.py # 1 doctest failed sage t src/sage/rings/finite_rings/element_ntl_gf2e.pyx # 3 doctests failed sage t src/sage/combinat/rigged_configurations/bij_type_D.py # 2 doctests failed sage t src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/method_of_graphs.rst # 2 doctests failed sage t src/sage/modular/modform_hecketriangle/series_constructor.py # 85 doctests failed sage t src/sage/rings/finite_rings/finite_field_ext_pari.py # 2 doctests failed sage t src/sage/combinat/sf/homogeneous.py # 2 doctests failed sage t src/sage/rings/quotient_ring_element.py # 2 doctests failed sage t src/sage/geometry/polyhedron/parent.py # 1 doctest failed sage t src/sage/sets/cartesian_product.py # 1 doctest failed sage t src/sage/modules/fg_pid/fgp_element.py # 1 doctest failed sage t src/sage/combinat/interval_posets.py # 418 doctests failed sage t src/sage/modules/module.pyx # 1 doctest failed sage t src/sage/categories/commutative_rings.py # 2 doctests failed sage t src/sage/combinat/integer_matrices.py # 1 doctest failed sage t src/sage/categories/examples/hopf_algebras_with_basis.py # 1 doctest failed sage t src/sage/rings/polynomial/polynomial_zz_pex.pyx # 21 doctests failed sage t src/sage/tensor/modules/finite_rank_free_module.py # 4 doctests failed sage t src/sage/combinat/sf/elementary.py # 2 doctests failed sage t src/sage/categories/regular_crystals.py # 1 doctest failed sage t src/sage/combinat/rigged_configurations/rc_crystal.py # 2 doctests failed sage t src/sage/modular/modform_hecketriangle/analytic_type.py # 113 doctests failed sage t src/sage/rings/finite_rings/homset.py # 24 doctests failed sage t src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx # 3 doctests failed sage t src/sage/rings/finite_rings/finite_field_prime_modn.py # 1 doctest failed sage t src/sage/modular/modsym/element.py # 1 doctest failed sage t src/sage/geometry/polyhedron/backend_cdd.py # 2 doctests failed sage t src/sage/groups/semimonomial_transformations/semimonomial_transformation_group.py # 29 doctests failed sage t src/sage/algebras/jordan_algebra.py # 4 doctests failed sage t src/sage/combinat/combinatorial_algebra.py # 2 doctests failed sage t src/sage/modules/with_basis/morphism.py # 8 doctests failed sage t src/sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi # 20 doctests failed sage t src/sage/algebras/letterplace/free_algebra_letterplace.pyx # 1 doctest failed sage t src/sage/schemes/generic/scheme.py # 3 doctests failed sage t src/sage/rings/complex_mpc.pyx # 6 doctests failed sage t src/sage/categories/modules.py # 1 doctest failed sage t src/sage/combinat/crystals/highest_weight_crystals.py # 2 doctests failed sage t src/sage/rings/finite_rings/element_base.pyx # 6 doctests failed sage t src/sage/geometry/newton_polygon.py # 2 doctests failed sage t src/sage/sets/family.py # 1 doctest failed sage t src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.py # 1 doctest failed sage t src/sage/algebras/weyl_algebra.py # 2 doctests failed sage t src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py # 1 doctest failed sage t src/sage/quivers/algebra.py # 1 doctest failed sage t src/sage/combinat/sf/multiplicative.py # 1 doctest failed sage t src/sage/tensor/modules/free_module_automorphism.py # 3 doctests failed sage t src/sage/rings/polynomial/polynomial_zmod_flint.pyx # 4 doctests failed sage t src/sage/combinat/crystals/affine.py # 2 doctests failed sage t src/sage/categories/algebras_with_basis.py # 1 doctest failed sage t src/sage/combinat/rooted_tree.py # 4 doctests failed sage t src/sage/monoids/hecke_monoid.py # 7 doctests failed sage t src/sage/groups/affine_gps/affine_group.py # 1 doctest failed sage t src/sage/modular/hecke/degenmap.py # 1 doctest failed sage t src/sage/modular/modsym/modular_symbols.py # 5 doctests failed sage t src/sage/modules/with_basis/subquotient.py # 2 doctests failed sage t src/sage/modular/abvar/lseries.py # 2 doctests failed sage t src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py # 1 doctest failed sage t src/sage/algebras/free_algebra_quotient.py # 3 doctests failed sage t src/sage/structure/parent_gens.pyx # 4 doctests failed sage t src/sage/groups/affine_gps/euclidean_group.py # 1 doctest failed sage t src/sage/combinat/integer_list_old.py # 1 doctest failed sage t src/sage/groups/abelian_gps/values.py # 2 doctests failed sage t src/sage/tensor/modules/free_module_alt_form.py # 1 doctest failed sage t src/sage/groups/affine_gps/group_element.py # 1 doctest failed sage t src/sage/algebras/free_algebra_quotient_element.py # 1 doctest failed sage t src/sage/tensor/modules/free_module_linear_group.py # 1 doctest failed sage t src/sage/geometry/polyhedron/base_RDF.py # 1 doctest failed sage t src/sage/tensor/modules/tensor_free_module.py # 1 doctest failed sage t src/sage/rings/finite_rings/hom_finite_field_givaro.pyx # 14 doctests failed sage t src/sage/tensor/modules/free_module_homset.py # 1 doctest failed sage t src/sage/rings/homset.py # 2 doctests failed sage t src/sage/combinat/lyndon_word.py # 1 doctest failed sage t src/sage/geometry/hyperbolic_space/hyperbolic_interface.py # 1 doctest failed sage t src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx # 35 doctests failed sage t src/sage/monoids/indexed_free_monoid.py # 8 doctests failed sage t src/sage/rings/polynomial/polynomial_gf2x.pyx # 2 doctests failed sage t src/sage/combinat/posets/elements.py # 1 doctest failed sage t src/sage/categories/examples/finite_dimensional_algebras_with_basis.py # 1 doctest failed sage t src/sage/combinat/rigged_configurations/bij_type_C.py # 2 doctests failed sage t src/sage/combinat/rigged_configurations/bij_type_A2_odd.py # 2 doctests failed sage t src/sage/schemes/generic/spec.py # 1 doctest failed sage t src/sage/geometry/polyhedron/backend_ppl.py # 1 doctest failed sage t src/sage/homology/koszul_complex.py # 1 doctest failed sage t src/sage/algebras/free_algebra_element.py # 2 doctests failed sage t src/sage/combinat/posets/linear_extensions.py # 101 doctests failed sage t src/sage/combinat/rigged_configurations/bij_type_A2_even.py # 2 doctests failed sage t src/sage/rings/noncommutative_ideals.pyx # 4 doctests failed sage t src/sage/combinat/rigged_configurations/bij_type_A2_dual.py # 2 doctests failed sage t src/sage/combinat/rigged_configurations/bij_type_A.py # 2 doctests failed sage t src/sage/categories/examples/sets_cat.py # 1 doctest failed sage t src/sage/rings/polynomial/polynomial_ring_homomorphism.pyx # 3 doctests failed sage t src/sage/geometry/polyhedron/base_QQ.py # 1 doctest failed sage t src/sage/combinat/necklace.py # 1 doctest failed sage t src/sage/rings/finite_rings/hom_prime_finite_field.pyx # 7 doctests failed sage t src/sage/groups/indexed_free_group.py # 4 doctests failed sage t src/sage/rings/ideal_monoid.py # 1 doctest failed sage t src/sage/categories/examples/finite_coxeter_groups.py # 1 doctest failed sage t src/sage/categories/examples/finite_monoids.py # 2 doctests failed sage t src/sage/sets/finite_set_map_cy.pyx # 29 doctests failed sage t src/sage/tensor/modules/ext_pow_free_module.py # 1 doctest failed sage t src/sage/categories/finite_crystals.py # 1 doctest failed sage t src/sage/sets/totally_ordered_finite_set.py # 3 doctests failed sage t src/sage/categories/finite_weyl_groups.py # 1 doctest failed sage t src/sage/modular/modsym/manin_symbol.pyx # 1 doctest failed sage t src/sage/categories/examples/algebras_with_basis.py # 1 doctest failed sage t src/sage/categories/examples/crystals.py # 1 doctest failed sage t src/sage/misc/nested_class_test.py # 2 doctests failed sage t src/sage/monoids/free_monoid.py # 1 doctest failed sage t src/sage/combinat/vector_partition.py # 2 doctests failed sage t src/sage/categories/examples/posets.py # 2 doctests failed sage t src/sage/categories/examples/graded_modules_with_basis.py # 1 doctest failed sage t src/sage/categories/examples/semigroups_cython.pyx # 4 doctests failed sage t src/sage/structure/list_clone_timings.py # 1 doctest failed sage t src/sage/categories/examples/commutative_additive_semigroups.py # 2 doctests failed sage t src/sage/rings/pari_ring.py # 1 doctest failed sage t src/sage/categories/examples/commutative_additive_monoids.py # 2 doctests failed sage t src/sage/categories/examples/monoids.py # 2 doctests failed sage t src/sage/monoids/monoid.py # 1 doctest failed 
comment:11 Changed 7 years ago by
Commit:  6c712ef6a941721e02054fa7d33c73047abe9839 → 1ba403001ee77e44e955918544bf97da6ce9c792 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
1ba4030  Metaclass for inheriting comparison functions

comment:12 Changed 7 years ago by
Commit:  1ba403001ee77e44e955918544bf97da6ce9c792 → 96886e932def46a1f9dfa8e09ff9979a5b2eb19f 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
96886e9  Metaclass for inheriting comparison functions

comment:13 Changed 7 years ago by
Dependencies:  #18321, #18322, #18330, #18380, #18387 → #18321, #18322, #18330, #18380, #18387, #18388 

comment:14 Changed 7 years ago by
Dependencies:  #18321, #18322, #18330, #18380, #18387, #18388 → #18321, #18322, #18330, #18380, #18387, #18388, #18389 

comment:15 Changed 7 years ago by
Commit:  96886e932def46a1f9dfa8e09ff9979a5b2eb19f → 9c8c73fbc853c1746a0f49706694fe0a826d5b50 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
9c8c73f  Metaclass for inheriting comparison functions

comment:16 Changed 7 years ago by
Commit:  9c8c73fbc853c1746a0f49706694fe0a826d5b50 → 381b844d2c9199d5f2afbaeda97a5e15f7ad51f2 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
381b844  Metaclass for inheriting comparison functions

comment:17 Changed 7 years ago by
Commit:  381b844d2c9199d5f2afbaeda97a5e15f7ad51f2 → c27cb6bd734e0ad4e0d0f4abb6d55cc1d859079e 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
c27cb6b  Metaclass for inheriting comparison functions

comment:18 Changed 7 years ago by
Commit:  c27cb6bd734e0ad4e0d0f4abb6d55cc1d859079e → 0bfb7e11591ae1b2289fe63e46a5d2b0a324cbcb 

comment:19 Changed 7 years ago by
Commit:  0bfb7e11591ae1b2289fe63e46a5d2b0a324cbcb → 36900fa6cc6a6721738665404dcaf86e883c573d 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
36900fa  Metaclass for inheriting comparison functions

comment:20 Changed 7 years ago by
Dependencies:  #18321, #18322, #18330, #18380, #18387, #18388, #18389 → #18389 

This now passes all doctests. All it needs now is some more documentation and testing.
comment:21 Changed 7 years ago by
Commit:  36900fa6cc6a6721738665404dcaf86e883c573d → 69f032500811f4c6933e93b50d04b145677d9384 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
69f0325  Metaclass for inheriting comparison functions

comment:22 Changed 7 years ago by
Status:  new → needs_review 

comment:23 Changed 7 years ago by
Commit:  69f032500811f4c6933e93b50d04b145677d9384 → ce032bd0adcb699f7f0696dfe65e9296d1a2ae90 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
ce032bd  Metaclass for inheriting comparison functions

comment:24 Changed 7 years ago by
Dependencies:  #18389 

comment:25 Changed 7 years ago by
Cc:  JeanPierre Flori added 

comment:26 Changed 7 years ago by
Commit:  ce032bd0adcb699f7f0696dfe65e9296d1a2ae90 → 4b08519ef79528cce58738b501751f1d5db9f519 

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
4b08519  Metaclass for inheriting comparison functions

comment:27 followup: 28 Changed 7 years ago by
Can you tell how it actually works?
Background of my question: I was about to open a ticket for "using Cython and the coercion model on combinatorial free modules". When I searched "cython combinatorial free module" on trac, your ticket was among the first hits. And of course, when cythoning the elements of a combinatorial free module, __cmp__
and __richcmp__
would still be copied rather than inherited from sage.structure.element.
comment:28 followup: 29 Changed 7 years ago by
Replying to SimonKing:
Can you tell how it actually works?
There are two things you need to know:
 The Cython "metaclass" mechanism implemented in #18330. This is similar to but not the same as a Python metaclass. It is a mechanism to change the
type()
of a Cython extension type and call the__init__
method (but not__new__
!) of the metaclass. Using the C preprocessor, a hook to implement this is added which is called whenever a Cython extension type is created.
 This ticket uses that mechanism to manually inherit the
tp_compare
andtp_richcompare
slots of extension types, see the code insrc/sage/misc/inherit_comparison.pyx
in the branch.
And of course, when cythoning the elements of a combinatorial free module,
__cmp__
and__richcmp__
would still be copied rather than inherited from sage.structure.element.
What do you mean with "would still be copied"? I don't understand what you're trying to say.
comment:29 followups: 30 31 Changed 7 years ago by
Replying to jdemeyer:
Replying to SimonKing:
Can you tell how it actually works?
There are two things you need to know:
 The Cython "metaclass" mechanism implemented in #18330. This is similar to but not the same as a Python metaclass. It is a mechanism to change the
type()
of a Cython extension type and call the__init__
method (but not__new__
!) of the metaclass. Using the C preprocessor, a hook to implement this is added which is called whenever a Cython extension type is created.
OK, I should have a look at that.
 This ticket uses that mechanism to manually inherit the
tp_compare
andtp_richcompare
slots of extension types, see the code insrc/sage/misc/inherit_comparison.pyx
in the branch.
I still don't understand what it is supposed to mean. What do you mean by "manually inherit"?
And of course, when cythoning the elements of a combinatorial free module,
__cmp__
and__richcmp__
would still be copied rather than inherited from sage.structure.element.What do you mean with "would still be copied"? I don't understand what you're trying to say.
See the comments in sage.structure.element:
#################################################################### # For a derived Cython class, you **must** put the __richcmp__ # method below in your subclasses, in order for it to take # advantage of the above generic comparison code. # # You must also define either _cmp_ (if your subclass is totally # ordered), _richcmp_ (if your subclass is partially ordered), or # both (if your class has both a total order and a partial order, # or if that gives better performance). # # Rich comparisons (like a < b) will default to using _richcmp_, # threeway comparisons (like cmp(a,b)) will default to using # _cmp_. But if you define just one of _richcmp_ and _cmp_, it will # be used for all kinds of comparisons. # # In the _cmp_ and _richcmp_ methods, you can assume that both # arguments have identical parents. ####################################################################
My understanding was that with the ticket here it would in future NOT be needed to copy the __cmp__
and __richcmp__
methods.
comment:30 Changed 7 years ago by
Replying to SimonKing:
 This ticket uses that mechanism to manually inherit the
tp_compare
andtp_richcompare
slots of extension types, see the code insrc/sage/misc/inherit_comparison.pyx
in the branch.I still don't understand what it is supposed to mean. What do you mean by "manually inherit"?
An extension type with the InheritComparisonMetaclass
"metaclass" will inherit __cmp__
and __richcmp__
from its base class if neither __cmp__
nor __richcmp__
is defined.
In practice, it means that we no longer need the boilerplate code
def __richcmp__(left, right, int op): return (<Element>left)._richcmp(right, op) def __cmp__(left, right): return (<Element>left)._cmp(right)
in subclasses of Element
since those will be inherited from Element
.
comment:31 Changed 7 years ago by
Replying to SimonKing:
My understanding was that with the ticket here it would in future NOT be needed to copy the
__cmp__
and__richcmp__
methods.
Exactly.
comment:32 Changed 7 years ago by
Commit:  4b08519ef79528cce58738b501751f1d5db9f519 → ac96e64f64566f688037eee427ee5175ec7134c9 

Branch pushed to git repo; I updated commit sha1. New commits:
ac96e64  Merge branch 'develop' into t/18329/ticket/18329

comment:33 followups: 34 36 Changed 7 years ago by
Did you submit the Cython patch upstream?
Another question, is there any doc about this in the dev manual or is there only the comments in element.pyx
?
I guess the latter comments should at least be modified.
Finally it seems to me that at the moment, this change only affects complex_mpc.pyx
and real_double.pyx
.
Is that correct?
comment:34 Changed 7 years ago by
Description:  modified (diff) 

Report Upstream:  N/A → Fixed upstream, but not in a stable release. 
Replying to jpflori:
Did you submit the Cython patch upstream?
Yes.
Finally it seems to me that at the moment, this change only affects
complex_mpc.pyx
andreal_double.pyx
. Is that correct?
Sure. I changed those as "proof of concept" to show that my patch works.
comment:35 followups: 39 50 Changed 7 years ago by
Ok, that is good news, I was kind of afraid that this patch was not so useful :)
Do you plan on opening a followup ticket to remove all the now superfluous boilerplate code?
I guess my only concern left is about the comments in elements.pyx
.
comment:36 Changed 7 years ago by
Replying to jpflori:
Another question, is there any doc about this in the dev manual
As far as I know, there is not. There is some documentation in src/doc/en/thematic_tutorials/coercion_and_categories.rst
, but that's really about Python only.
I do plan to write documentation in #18306, but I haven't gotten around to actually do it.
or is there only the comments in
element.pyx
? I guess the latter comments should at least be modified.
I'll have a look.
comment:37 Changed 7 years ago by
Commit:  ac96e64f64566f688037eee427ee5175ec7134c9 → 0e0301a6a3b6ded29b63db8531e57f9e564834d6 

Branch pushed to git repo; I updated commit sha1. New commits:
0e0301a  Fix documentation

comment:38 Changed 7 years ago by
Reviewers:  → JeanPierre Flori 

Status:  needs_review → positive_review 
Thanks!
comment:39 Changed 7 years ago by
Replying to jpflori:
Do you plan on opening a followup ticket to remove all the now superfluous boilerplate code?
Since this would be ticket with a lot of potential conflicts, it's best if the author and potential reviewer agree in advance that such a thing be a good idea and to try to get that ticket merged quickly after a new beta comes out.
Can you do that?
comment:40 Changed 7 years ago by
Status:  positive_review → needs_work 

sage t long src/sage/structure/dynamic_class.py ********************************************************************** File "src/sage/structure/dynamic_class.py", line 358, in sage.structure.dynamic_class.dynamic_class_internal Failed example: inspect.getfile(Foo2) Expected: '.../sage/structure/dynamic_class.pyc' Got: '/Users/buildslavesage/slave/sage_git/build/local/lib/python2.7/sitepackages/sage/structure/dynamic_class.py' ********************************************************************** File "src/sage/structure/dynamic_class.py", line 360, in sage.structure.dynamic_class.dynamic_class_internal Failed example: inspect.getfile(Foo3) Expected: '.../sage/structure/dynamic_class.pyc' Got: '/Users/buildslavesage/slave/sage_git/build/local/lib/python2.7/sitepackages/sage/structure/dynamic_class.py' ********************************************************************** 1 item had failures: 2 of 20 in sage.structure.dynamic_class.dynamic_class_internal [69 tests, 2 failures, 0.49 s]
comment:41 Changed 7 years ago by
Any clue why the extension changed from .pyc
to .py
? Can we just change the doctest? This doesn't really look related to this ticket.
comment:42 Changed 7 years ago by
I think its because import dynamic_class
was removed somewhere, changing the internal caching. IMHO the doctest should be using sage.misc.sageinspect.sage_getfile()
comment:46 Changed 7 years ago by
Can we still replace it with sage.misc.sageinspect.sage_getfile
which afaik normalized pyc > py filenames? I don't have time to try to reproduces this and its just waiting for trouble anyways. Might be due to timing issues if it depends on import order, too.
comment:47 Changed 7 years ago by
Commit:  0e0301a6a3b6ded29b63db8531e57f9e564834d6 → f6058e75cd8e77133188bc83844fcde05c3033c0 

Branch pushed to git repo; I updated commit sha1. New commits:
f6058e7  Use sage_getfile instead of inspect.getfile

comment:48 Changed 7 years ago by
Status:  needs_work → positive_review 

New commits:
f6058e7  Use sage_getfile instead of inspect.getfile

comment:49 Changed 7 years ago by
Branch:  u/jdemeyer/ticket/18329 → f6058e75cd8e77133188bc83844fcde05c3033c0 

Resolution:  → fixed 
Status:  positive_review → closed 
comment:50 Changed 7 years ago by
Commit:  f6058e75cd8e77133188bc83844fcde05c3033c0 

Last 10 new commits:
Implement _rich_to_bool as inline function instead of member function
Merge tag '6.7.beta2' into t/17890/ticket/17890
Optimize rich_to_bool_sgn
Improve comparisons for permutation groups
Improve _richcmp and documentation
Fix doctest formatting
Fix bad doctest in etaproducts
Add pointers for special uses of __richcmp__
Merge remotetracking branch 'origin/u/jdemeyer/ticket/17890' into u/jdemeyer/don_t_cimport_type
Add hook for PyType_Ready