#24528 closed enhancement (fixed)
py3: wrap parameter of islice with int
Reported by: | chapoton | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.2 |
Component: | python3 | Keywords: | |
Cc: | dimpase, embray, tscrim, jdemeyer | Merged in: | |
Authors: | Frédéric Chapoton | Reviewers: | Dima Pasechnik |
Report Upstream: | Fixed upstream, but not in a stable release. | Work issues: | |
Branch: | 3ea05e4 (Commits, GitHub, GitLab) | Commit: | |
Dependencies: | Stopgaps: |
Description (last modified by )
to work around an upstream Python bug https://bugs.python.org/issue30537
Change History (14)
comment:1 Changed 4 years ago by
- Branch set to u/chapoton/24528
- Commit set to 3ea05e416d78f70196357cd157904da68daa5d1a
- Status changed from new to needs_review
comment:2 follow-up: ↓ 6 Changed 4 years ago by
- Cc jdemeyer added
- Reviewers set to Dima Pasechnik
- Status changed from needs_review to positive_review
looks good to me.
I cannot help thinking that this is actually a Python bug, for they should accept
anything in numbers.Integral
as input, and not only int
.
Maybe someone with more insight into Python guts can comment. Jeroen?
comment:4 Changed 4 years ago by
sage: designs.AffineGeometryDesign(4,3,2) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-2-7ddfea1de362> in <module>() ----> 1 designs.AffineGeometryDesign(Integer(4),Integer(3),Integer(2)) /home/chapoton/sage3/local/lib/python3.6/site-packages/sage/combinat/designs/block_design.py in AffineGeometryDesign(n, d, F, point_coordinates, check) 861 l1 = q_binomial(n+1, d+1, q) - q_binomial(n, d+1, q) 862 l2 = q**d --> 863 for m1 in islice(reduced_echelon_matrix_iterator(F,d+1,n+1,copy=False), l1): 864 b = [] 865 for m2 in islice(reduced_echelon_matrix_iterator(F,1,d+1,copy=False), l2): ValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.
EDIT: and yes, this is the full traceback
comment:5 Changed 4 years ago by
- Description modified (diff)
- Report Upstream changed from N/A to Fixed upstream, but not in a stable release.
comment:6 in reply to: ↑ 2 ; follow-up: ↓ 11 Changed 4 years ago by
Replying to dimpase:
looks good to me.
I cannot help thinking that this is actually a Python bug, for they should accept anything in
numbers.Integral
as input, and not onlyint
. Maybe someone with more insight into Python guts can comment. Jeroen?
It's sort of a bug. I brought this up here: https://mail.python.org/pipermail/python-ideas/2017-December/048411.html
comment:7 Changed 4 years ago by
I fixed a bunch more examples like this in my python 3 branch, although not this specific one. It seems silly to me to have a ticket for just one line of this, but what's done is done.
I need to make more tickets for all the fixes I already have in order to save duplicate effort. It's just...a lot...and I need to think of logical ways to break it up.
comment:8 Changed 4 years ago by
Basically if you're thinking of fixing any little issue in any of the following modules, chances are I've already fixed it:
modified: src/sage/algebras/clifford_algebra.py modified: src/sage/algebras/free_algebra.py modified: src/sage/algebras/free_algebra_quotient.py modified: src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx modified: src/sage/algebras/orlik_solomon.py modified: src/sage/algebras/quatalg/quaternion_algebra.py modified: src/sage/algebras/steenrod/steenrod_algebra.py modified: src/sage/algebras/steenrod/steenrod_algebra_bases.py modified: src/sage/arith/long.pxd modified: src/sage/arith/misc.py modified: src/sage/calculus/integration.pyx modified: src/sage/calculus/ode.pyx modified: src/sage/categories/finite_dimensional_algebras_with_basis.py modified: src/sage/categories/functor.pyx modified: src/sage/categories/magmas.py modified: src/sage/categories/morphism.pyx modified: src/sage/categories/pushout.py modified: src/sage/categories/sets_cat.py modified: src/sage/categories/unital_algebras.py modified: src/sage/coding/decoder.py modified: src/sage/coding/hamming_code.py modified: src/sage/coding/linear_code.py modified: src/sage/coding/subfield_subcode.py modified: src/sage/combinat/combinat.py modified: src/sage/combinat/crystals/generalized_young_walls.py modified: src/sage/combinat/finite_state_machine.py modified: src/sage/combinat/free_module.py modified: src/sage/combinat/gray_codes.py modified: src/sage/combinat/integer_lists/base.pyx modified: src/sage/combinat/integer_lists/invlex.pyx modified: src/sage/combinat/integer_matrices.py modified: src/sage/combinat/integer_vector.py modified: src/sage/combinat/multichoose_nk.py modified: src/sage/combinat/permutation.py modified: src/sage/combinat/ribbon_shaped_tableau.py modified: src/sage/combinat/rigged_configurations/rigged_partition.py modified: src/sage/combinat/root_system/type_dual.py modified: src/sage/combinat/sf/k_dual.py modified: src/sage/combinat/sf/new_kschur.py modified: src/sage/combinat/sidon_sets.py modified: src/sage/combinat/skew_tableau.py modified: src/sage/combinat/species/series.py modified: src/sage/combinat/subset.py modified: src/sage/combinat/subword_complex.py modified: src/sage/combinat/tiling.py modified: src/sage/combinat/words/word_datatypes.pyx modified: src/sage/combinat/words/word_infinite_datatypes.py modified: src/sage/cpython/cython_metaclass.pyx modified: src/sage/cpython/dict_del_by_value.pyx modified: src/sage/cpython/getattr.pyx modified: src/sage/cpython/string.pxd modified: src/sage/cpython/wrapperdescr.pxd modified: src/sage/cpython/wrapperdescr.pyx modified: src/sage/data_structures/bitset.pxi modified: src/sage/databases/conway.py modified: src/sage/databases/cremona.py modified: src/sage/doctest/forker.py modified: src/sage/ext/fast_callable.pyx modified: src/sage/finance/stock.py modified: src/sage/finance/time_series.pyx modified: src/sage/functions/min_max.py modified: src/sage/functions/other.py modified: src/sage/functions/wigner.py modified: src/sage/geometry/polyhedron/backend_cdd.py modified: src/sage/graphs/bipartite_graph.py modified: src/sage/graphs/generators/degree_sequence.py modified: src/sage/graphs/generic_graph.py modified: src/sage/graphs/generic_graph_pyx.pyx modified: src/sage/graphs/graph_list.py modified: src/sage/graphs/hypergraph_generators.py modified: src/sage/graphs/tutte_polynomial.py modified: src/sage/groups/abelian_gps/abelian_group.py modified: src/sage/groups/perm_gps/permgroup_named.py modified: src/sage/homology/chain_complex.py modified: src/sage/homology/chain_complex_morphism.py modified: src/sage/homology/examples.py modified: src/sage/homology/simplicial_complex.py modified: src/sage/homology/simplicial_complex_morphism.py modified: src/sage/interacts/debugger.py modified: src/sage/interfaces/ecm.py modified: src/sage/interfaces/expect.py modified: src/sage/interfaces/gap.py modified: src/sage/interfaces/interface.py modified: src/sage/interfaces/maxima.py modified: src/sage/interfaces/maxima_abstract.py modified: src/sage/interfaces/process.pyx modified: src/sage/interfaces/qsieve.py modified: src/sage/interfaces/quit.py modified: src/sage/interfaces/rubik.py modified: src/sage/interfaces/sage0.py modified: src/sage/interfaces/singular.py modified: src/sage/interfaces/tachyon.py modified: src/sage/interfaces/tides.py modified: src/sage/knots/link.py modified: src/sage/libs/ecl.pyx modified: src/sage/libs/eclib/mwrank.pyx modified: src/sage/libs/glpk/error.pyx modified: src/sage/libs/mpmath/ext_impl.pyx modified: src/sage/libs/mpmath/ext_libmp.pyx modified: src/sage/libs/mpmath/ext_main.pyx modified: src/sage/libs/ntl/error.pyx modified: src/sage/libs/ntl/ntl_GF2X.pyx modified: src/sage/libs/ntl/ntl_ZZ.pyx modified: src/sage/libs/ntl/ntl_ZZX.pyx modified: src/sage/libs/ntl/ntl_ZZ_p.pyx modified: src/sage/libs/ntl/ntl_ZZ_pE.pyx modified: src/sage/libs/ntl/ntl_ZZ_pX.pyx modified: src/sage/logic/logic.py modified: src/sage/logic/logicparser.py modified: src/sage/manifolds/continuous_map.py modified: src/sage/matrix/matrix2.pyx modified: src/sage/matrix/matrix_cyclo_dense.pyx modified: src/sage/matrix/matrix_generic_sparse.pyx modified: src/sage/matrix/matrix_integer_dense.pyx modified: src/sage/matrix/matrix_rational_dense.pyx modified: src/sage/matrix/misc.pyx modified: src/sage/misc/banner.py modified: src/sage/misc/c3.pyx modified: src/sage/misc/constant_function.pyx modified: src/sage/misc/explain_pickle.py modified: src/sage/misc/function_mangling.pyx modified: src/sage/misc/lazy_attribute.pyx modified: src/sage/misc/lazy_import.pyx modified: src/sage/misc/misc.py modified: src/sage/misc/object_multiplexer.py modified: src/sage/misc/parser.pyx modified: src/sage/misc/prandom.py modified: src/sage/misc/reset.pyx modified: src/sage/misc/rest_index_of_methods.py modified: src/sage/misc/session.pyx modified: src/sage/misc/stopgap.pyx modified: src/sage/misc/superseded.py modified: src/sage/misc/test_class_pickling.py modified: src/sage/misc/trace.py modified: src/sage/misc/unknown.py modified: src/sage/modular/arithgroup/congroup_generic.py modified: src/sage/modular/modsym/ambient.py modified: src/sage/modules/free_module_element.pyx modified: src/sage/modules/module.pyx modified: src/sage/modules/with_basis/indexed_element.pyx modified: src/sage/monoids/automatic_semigroup.py modified: src/sage/monoids/free_monoid.py modified: src/sage/numerical/backends/coin_backend.pyx modified: src/sage/numerical/backends/cplex_backend.pyx modified: src/sage/numerical/backends/cvxopt_backend.pyx modified: src/sage/numerical/backends/generic_backend.pxd modified: src/sage/numerical/backends/generic_backend.pyx modified: src/sage/numerical/backends/glpk_backend.pyx modified: src/sage/numerical/backends/gurobi_backend.pyx modified: src/sage/numerical/backends/interactivelp_backend.pyx modified: src/sage/numerical/backends/ppl_backend.pyx modified: src/sage/parallel/multiprocessing_sage.py modified: src/sage/parallel/use_fork.py modified: src/sage/plot/plot3d/base.pyx modified: src/sage/plot/plot3d/index_face_set.pyx modified: src/sage/probability/random_variable.py modified: src/sage/quadratic_forms/extras.py modified: src/sage/quadratic_forms/quadratic_form__siegel_product.py modified: src/sage/repl/attach.py modified: src/sage/repl/ipython_kernel/interact.py modified: src/sage/repl/load.py modified: src/sage/repl/preparse.py modified: src/sage/repl/rich_output/backend_doctest.py modified: src/sage/repl/rich_output/buffer.py modified: src/sage/repl/rich_output/output_basic.py modified: src/sage/repl/rich_output/output_browser.py modified: src/sage/repl/rich_output/output_graphics.py modified: src/sage/repl/rich_output/output_graphics3d.py modified: src/sage/rings/continued_fraction.py modified: src/sage/rings/finite_rings/element_givaro.pyx modified: src/sage/rings/finite_rings/finite_field_base.pyx modified: src/sage/rings/finite_rings/integer_mod.pyx modified: src/sage/rings/fraction_field.py modified: src/sage/rings/fraction_field_element.pyx modified: src/sage/rings/ideal_monoid.py modified: src/sage/rings/integer.pyx modified: src/sage/rings/number_field/number_field.py modified: src/sage/rings/number_field/order.py modified: src/sage/rings/number_field/small_primes_of_degree_one.py modified: src/sage/rings/number_field/unit_group.py modified: src/sage/rings/padics/padic_extension_generic.py modified: src/sage/rings/polynomial/infinite_polynomial_ring.py modified: src/sage/rings/polynomial/laurent_polynomial_ring.py modified: src/sage/rings/polynomial/multi_polynomial_element.py modified: src/sage/rings/polynomial/multi_polynomial_ideal.py modified: src/sage/rings/polynomial/multi_polynomial_libsingular.pyx modified: src/sage/rings/polynomial/multi_polynomial_ring.py modified: src/sage/rings/polynomial/multi_polynomial_ring_generic.pyx modified: src/sage/rings/polynomial/plural.pyx modified: src/sage/rings/polynomial/polydict.pyx modified: src/sage/rings/polynomial/polynomial_complex_arb.pyx modified: src/sage/rings/polynomial/polynomial_element.pyx modified: src/sage/rings/polynomial/polynomial_element_generic.py modified: src/sage/rings/polynomial/polynomial_quotient_ring.py modified: src/sage/rings/polynomial/polynomial_rational_flint.pyx modified: src/sage/rings/polynomial/polynomial_ring.py modified: src/sage/rings/quotient_ring_element.py modified: src/sage/rings/rational.pyx modified: src/sage/rings/real_double.pyx modified: src/sage/rings/real_mpfi.pyx modified: src/sage/rings/real_mpfr.pyx modified: src/sage/rings/sum_of_squares.pyx modified: src/sage/schemes/elliptic_curves/ec_database.py modified: src/sage/schemes/toric/points.py modified: src/sage/sets/disjoint_set.pyx modified: src/sage/sets/set.py modified: src/sage/sets/totally_ordered_finite_set.py modified: src/sage/stats/basic_stats.py modified: src/sage/stats/intlist.pyx modified: src/sage/structure/coerce.pyx modified: src/sage/structure/element_wrapper.pyx modified: src/sage/structure/proof/proof.py modified: src/sage/structure/sage_object.pyx modified: src/sage/structure/test_factory.py modified: src/sage/symbolic/expression.pyx modified: src/sage/symbolic/operators.py modified: src/sage/symbolic/ring.pyx modified: src/sage/tensor/modules/comp.py modified: src/sage/tests/french_book/nonlinear_doctest.py modified: src/sage/typeset/character_art_factory.py modified: src/sage_setup/autogen/interpreters/__init__.py modified: src/sage_setup/autogen/interpreters/generator.py modified: src/sage_setup/autogen/interpreters/specs/cdf.py modified: src/sage_setup/autogen/interpreters/specs/element.py modified: src/sage_setup/autogen/interpreters/specs/python.py modified: src/sage_setup/autogen/interpreters/utils.py
comment:9 Changed 4 years ago by
maybe it is better not to split, but just bite the bullet and get it in? Perhaps in a dedicated beta?
comment:10 Changed 4 years ago by
Well, it still needs to be reviewed and that works better in small pieces.
comment:11 in reply to: ↑ 6 Changed 4 years ago by
Replying to embray:
Replying to dimpase:
looks good to me.
I cannot help thinking that this is actually a Python bug, for they should accept anything in
numbers.Integral
as input, and not onlyint
. Maybe someone with more insight into Python guts can comment. Jeroen?It's sort of a bug. I brought this up here: https://mail.python.org/pipermail/python-ideas/2017-December/048411.html
It seems unfortunate and short-sighted that instead of understanding the need for numbers.Integral
-parameters to be accepted by the standard library functions throughout,
python devs start lamenting about loss in efficiency in cpython...
comment:12 follow-up: ↓ 14 Changed 4 years ago by
I would rather review one limited in scope patchbomb like this than 20 tickets fixing the same issue in different files.
comment:13 Changed 4 years ago by
- Branch changed from u/chapoton/24528 to 3ea05e416d78f70196357cd157904da68daa5d1a
- Resolution set to fixed
- Status changed from positive_review to closed
comment:14 in reply to: ↑ 12 Changed 4 years ago by
- Commit 3ea05e416d78f70196357cd157904da68daa5d1a deleted
Replying to dimpase:
I would rather review one limited in scope patchbomb like this than 20 tickets fixing the same issue in different files.
Unfortunately it's not limited scope. Well many of the changes could be organized into a few basic categories (the majority are either dealing with str/bytes or __hash__
and __cmp__
issues, I think), it's way too much to look at all at once. Also the reason I'm so behind on opening tickets for all these changes is that many of them are incomplete or only temporary hacks to get other tests passing. So I have a lot of work to do in organizing all this. I'm trying my best to catch up.
New commits:
py3: one detail in block designs