summarylogtreecommitdiffstats
path: root/sagemath-cython-0.29.20.patch
blob: e787b24679bc76637b29ebdff6090bf7a2463ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
diff --git a/src/sage/algebras/lie_algebras/lie_algebra_element.pyx b/src/sage/algebras/lie_algebras/lie_algebra_element.pyx
index d519d37b61..6a477f755c 100644
--- a/src/sage/algebras/lie_algebras/lie_algebra_element.pyx
+++ b/src/sage/algebras/lie_algebras/lie_algebra_element.pyx
@@ -403,7 +403,7 @@ cdef class LieAlgebraElementWrapper(ElementWrapper):
             right = (<LieAlgebraElementWrapper> right).lift()
         return left * right
 
-    def __div__(self, x):
+    def __truediv__(self, x):
         """
         Division by coefficients.
 
diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py
index 67965111f6..a267923655 100644
--- a/src/sage/algebras/weyl_algebra.py
+++ b/src/sage/algebras/weyl_algebra.py
@@ -567,8 +567,6 @@ class DifferentialWeylAlgebraElement(AlgebraElement):
 
         return self.__class__(F, {t: D[t]._divide_if_possible(x) for t in D})
 
-    __div__ = __truediv__
-
     def factor_differentials(self):
         """
         Return a dict representing ``self`` with the differentials
diff --git a/src/sage/categories/examples/lie_algebras.py b/src/sage/categories/examples/lie_algebras.py
index 695bd7c1b1..3bcdd817da 100644
--- a/src/sage/categories/examples/lie_algebras.py
+++ b/src/sage/categories/examples/lie_algebras.py
@@ -261,7 +261,7 @@ class LieAlgebraFromAssociative(Parent, UniqueRepresentation):
                 return self.__class__(self.parent(), self.value * scalar)
             return self.__class__(self.parent(), scalar * self.value)
 
-        def __div__(self, x, self_on_left=False):
+        def __truediv__(self, x, self_on_left=False):
             """
             Division by coefficients.
 
diff --git a/src/sage/combinat/binary_tree.py b/src/sage/combinat/binary_tree.py
index cb2b1376c7..774a758a6f 100644
--- a/src/sage/combinat/binary_tree.py
+++ b/src/sage/combinat/binary_tree.py
@@ -3183,7 +3183,6 @@ class BinaryTree(AbstractClonableTree, ClonableArray,
         else:
             return B([self[0], self[1].over(bt)])
 
-    __div__ = over
     __truediv__ = over
 
     @combinatorial_map(name="Under operation on Binary Trees")
diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py
index 0513e23409..f2572c077a 100644
--- a/src/sage/combinat/partition.py
+++ b/src/sage/combinat/partition.py
@@ -1054,8 +1054,6 @@ class Partition(CombinatorialElement):
 
         return SkewPartition([self[:], p])
 
-    __div__ = __truediv__
-
     def power(self, k):
         r"""
         Return the cycle type of the `k`-th power of any permutation
diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py
index da464af764..59c23d3852 100644
--- a/src/sage/combinat/tableau.py
+++ b/src/sage/combinat/tableau.py
@@ -785,8 +785,6 @@ class Tableau(ClonableList, metaclass=InheritComparisonClasscallMetaclass):
         from sage.combinat.skew_tableau import SkewTableau
         return SkewTableau(st)
 
-    __div__ = __truediv__
-
     def __call__(self, *cell):
         r"""
 
diff --git a/src/sage/ext/fast_callable.pyx b/src/sage/ext/fast_callable.pyx
index 86033d983b..580f115692 100644
--- a/src/sage/ext/fast_callable.pyx
+++ b/src/sage/ext/fast_callable.pyx
@@ -422,39 +422,6 @@ def fast_callable(x, domain=None, vars=None,
         Traceback (most recent call last):
             ...
         TypeError: unable to simplify to float approximation
-
-    Check :trac:`24805`--if a fast_callable expression involves division
-    on a Python object, it will always prefer Python 3 semantics (e.g.
-    ``x / y`` will try ``x.__truediv__`` instead of ``x.__div__``, as if
-    ``from __future__ import division`` is in effect).  However, for
-    classes that implement ``__div__`` but not ``__truediv__`` it will still
-    fall back on ``__div__`` for backwards-compatibility, but reliance on
-    this functionality is deprecated::
-
-        sage: from sage.ext.fast_callable import ExpressionTreeBuilder
-        sage: etb = ExpressionTreeBuilder('x')
-        sage: x = etb.var('x')
-        sage: class One(object):
-        ....:     def __div__(self, other):
-        ....:         if not isinstance(other, Integer):
-        ....:             return NotImplemented
-        ....:         return 1 / other
-        sage: expr = One() / x
-        sage: f = fast_callable(expr, vars=[x])
-        sage: f(2)  # py2
-        doctest:warning...:
-        DeprecationWarning: use of __truediv__ should be preferred over __div__
-        See https://trac.sagemath.org/24805 for details.
-        1/2
-        sage: class ModernOne(One):
-        ....:     def __truediv__(self, other):
-        ....:         if not isinstance(other, Integer):
-        ....:             return NotImplemented
-        ....:         return 1 / other
-        sage: expr = ModernOne() / x
-        sage: f = fast_callable(expr, vars=[x])
-        sage: f(2)
-        1/2
     """
     cdef Expression et
     if isinstance(x, Expression):
@@ -960,28 +927,6 @@ cdef class Expression:
         """
         return _expression_binop_helper(s, o, op_truediv)
 
-    def __div__(s, o):
-        r"""
-        Compute a quotient of two Expressions.
-
-        EXAMPLES::
-
-            sage: from sage.ext.fast_callable import ExpressionTreeBuilder
-            sage: etb = ExpressionTreeBuilder(vars=(x,))
-            sage: x = etb(x)
-            sage: x/x
-            div(v_0, v_0)
-            sage: x/1
-            div(v_0, 1)
-            sage: 1/x
-            div(1, v_0)
-            sage: x.__div__(1)  # py2
-            div(v_0, 1)
-            sage: x.__rdiv__(1)  # py2
-            div(1, v_0)
-        """
-        return _expression_binop_helper(s, o, op_div)
-
     def __floordiv__(s, o):
         r"""
         Compute the floordiv (the floor of the quotient) of two Expressions.
diff --git a/src/sage/ext/fast_eval.pyx b/src/sage/ext/fast_eval.pyx
index 1d2c1bf447..d4e736b83e 100644
--- a/src/sage/ext/fast_eval.pyx
+++ b/src/sage/ext/fast_eval.pyx
@@ -797,17 +797,6 @@ cdef class FastDoubleFunc:
         """
         return binop(left, right, DIV)
 
-    def __div__(left, right):
-        """
-        EXAMPLES::
-
-            sage: from sage.ext.fast_eval import fast_float_arg
-            sage: f = fast_float_arg(0) / 7
-            sage: f(14)
-            2.0
-        """
-        return binop(left, right, DIV)
-
     def __pow__(FastDoubleFunc left, right, dummy):
         """
         EXAMPLES::
diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py
index 8e82e94168..ee3a8b5cfb 100644
--- a/src/sage/geometry/polyhedron/base.py
+++ b/src/sage/geometry/polyhedron/base.py
@@ -4932,8 +4932,6 @@ class Polyhedron_base(Element):
         """
         return self.dilation(1/scalar)
 
-    __div__ = __truediv__
-
     @coerce_binop
     def convex_hull(self, other):
         """
diff --git a/src/sage/libs/mpmath/ext_main.pyx b/src/sage/libs/mpmath/ext_main.pyx
index ac89834fee..694cc089e7 100644
--- a/src/sage/libs/mpmath/ext_main.pyx
+++ b/src/sage/libs/mpmath/ext_main.pyx
@@ -1586,19 +1586,6 @@ cdef class mpnumber:
         """
         return binop(OP_MUL, self, other, global_opts)
 
-    def __div__(self, other):
-        """
-        Division of mpmath numbers. Compatible numerical types
-        are automatically converted to mpmath numbers ::
-
-            sage: from mpmath import mpf, mpc
-            sage: mpf(10) / mpc(5)
-            mpc(real='2.0', imag='0.0')
-            sage: float(9) / mpf(3)
-            mpf('3.0')
-        """
-        return binop(OP_DIV, self, other, global_opts)
-
     def __truediv__(self, other):
         """
         Division of mpmath numbers. Compatible numerical types
diff --git a/src/sage/libs/ntl/ntl_GF2.pyx b/src/sage/libs/ntl/ntl_GF2.pyx
index 21f69956b7..1a03ed5ebd 100644
--- a/src/sage/libs/ntl/ntl_GF2.pyx
+++ b/src/sage/libs/ntl/ntl_GF2.pyx
@@ -153,9 +153,6 @@ cdef class ntl_GF2(object):
         GF2_div(r.x, (<ntl_GF2>self).x, (<ntl_GF2>other).x)
         return r
 
-    def __div__(self, other):
-        return self / other
-
     def __sub__(self, other):
         """
             sage: o = ntl.GF2(1)
diff --git a/src/sage/libs/ntl/ntl_GF2E.pyx b/src/sage/libs/ntl/ntl_GF2E.pyx
index f45ad616a9..f9072cbc61 100644
--- a/src/sage/libs/ntl/ntl_GF2E.pyx
+++ b/src/sage/libs/ntl/ntl_GF2E.pyx
@@ -284,9 +284,6 @@ cdef class ntl_GF2E(object):
         GF2E_div(r.x, self.x, (<ntl_GF2E>other).x)
         return r
 
-    def __div__(self, other):
-        return self / other
-
     def __neg__(ntl_GF2E self):
         """
         EXAMPLES::
diff --git a/src/sage/libs/ntl/ntl_GF2X.pyx b/src/sage/libs/ntl/ntl_GF2X.pyx
index f3817f9cac..b80766b4ec 100644
--- a/src/sage/libs/ntl/ntl_GF2X.pyx
+++ b/src/sage/libs/ntl/ntl_GF2X.pyx
@@ -224,9 +224,6 @@ cdef class ntl_GF2X(object):
             raise ArithmeticError("self (=%s) is not divisible by b (=%s)" % (self, b))
         return q
 
-    def __div__(self, other):
-        return self / other
-
     def DivRem(ntl_GF2X self, b):
         """
         EXAMPLES::
diff --git a/src/sage/libs/ntl/ntl_ZZX.pyx b/src/sage/libs/ntl/ntl_ZZX.pyx
index 22e945814a..4d602df903 100644
--- a/src/sage/libs/ntl/ntl_ZZX.pyx
+++ b/src/sage/libs/ntl/ntl_ZZX.pyx
@@ -360,9 +360,6 @@ cdef class ntl_ZZX(object):
         result = make_ZZX_sig_off(q)
         return result
 
-    def __div__(self, other):
-        return self / other
-
     def __mod__(ntl_ZZX self, ntl_ZZX other):
         """
         Given polynomials a, b in ZZ[X], there exist polynomials q, r
diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx
index b8f07db7c7..78b4216ac9 100644
--- a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx
+++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx
@@ -379,9 +379,6 @@ cdef class ntl_ZZ_pEX(object):
             raise ArithmeticError("self (=%s) is not divisible by other (=%s)" % (self, other))
         return r
 
-    def __div__(self, other):
-        return self / other
-
     def __mod__(ntl_ZZ_pEX self, ntl_ZZ_pEX other):
         """
         Given polynomials a, b in ZZ_pE[X], if p is prime and the defining modulus irreducible,
diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pyx b/src/sage/libs/ntl/ntl_ZZ_pX.pyx
index a31f9a4c80..0d18d06c4f 100644
--- a/src/sage/libs/ntl/ntl_ZZ_pX.pyx
+++ b/src/sage/libs/ntl/ntl_ZZ_pX.pyx
@@ -407,9 +407,6 @@ cdef class ntl_ZZ_pX(object):
             raise ArithmeticError("self (=%s) is not divisible by other (=%s)" % (self, other))
         return r
 
-    def __div__(self, other):
-        return self / other
-
     def __mod__(ntl_ZZ_pX self, ntl_ZZ_pX other):
         """
         Given polynomials a, b in ZZ_p[X], if p is prime, then there exist polynomials q, r
diff --git a/src/sage/libs/ntl/ntl_lzz_p.pyx b/src/sage/libs/ntl/ntl_lzz_p.pyx
index 582e6f088f..6363f05f79 100644
--- a/src/sage/libs/ntl/ntl_lzz_p.pyx
+++ b/src/sage/libs/ntl/ntl_lzz_p.pyx
@@ -253,9 +253,6 @@ cdef class ntl_zz_p(object):
         sig_off()
         return q
 
-    def __div__(self, other):
-        return self / other
-
     def __pow__(ntl_zz_p self, long n, ignored):
         """
         Return the n-th nonnegative power of self.
diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pyx b/src/sage/libs/ntl/ntl_lzz_pX.pyx
index d953a55248..1f2be8bd60 100644
--- a/src/sage/libs/ntl/ntl_lzz_pX.pyx
+++ b/src/sage/libs/ntl/ntl_lzz_pX.pyx
@@ -352,9 +352,6 @@ cdef class ntl_zz_pX(object):
             raise ArithmeticError("self (=%s) is not divisible by other (=%s)" % (self, other))
         return q
 
-    def __div__(self, other):
-        return self / other
-
     def __mod__(ntl_zz_pX self, other):
         """
         Given polynomials a, b in ZZ[X], there exist polynomials q, r
diff --git a/src/sage/manifolds/differentiable/tensorfield.py b/src/sage/manifolds/differentiable/tensorfield.py
index e136fb8055..a7b526dd83 100644
--- a/src/sage/manifolds/differentiable/tensorfield.py
+++ b/src/sage/manifolds/differentiable/tensorfield.py
@@ -2750,7 +2750,7 @@ class TensorField(ModuleElement):
             f: M --> R
             on U: (x, y) |--> 1/(x^2 + y^2 + 1)
             on V: (u, v) |--> 2/(u^2 + v^2 + 2)
-            sage: s = a.__div__(f); s
+            sage: s = a.__truediv__(f); s
             Tensor field of type (1,1) on the 2-dimensional differentiable
              manifold M
             sage: s.display(e_xy)
@@ -2761,7 +2761,7 @@ class TensorField(ModuleElement):
 
         Division by a number::
 
-            sage: s = a.__div__(2); s
+            sage: s = a.__truediv__(2); s
             Tensor field of type (1,1) on the 2-dimensional differentiable
              manifold M
             sage: s.display(e_xy)
@@ -2780,8 +2780,6 @@ class TensorField(ModuleElement):
             resu._restrictions[dom] = rst / scalar
         return resu
 
-    __div__ = __truediv__
-
     def __call__(self, *args):
         r"""
         The tensor field acting on 1-forms and vector fields as a
diff --git a/src/sage/matrix/matrix_gfpn_dense.pyx b/src/sage/matrix/matrix_gfpn_dense.pyx
index 42af34dc10..698af79b55 100644
--- a/src/sage/matrix/matrix_gfpn_dense.pyx
+++ b/src/sage/matrix/matrix_gfpn_dense.pyx
@@ -1392,7 +1392,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense):
             sig_off()
         return new_mtx(mat, self)
 
-    def __div__(Matrix_gfpn_dense self, p):
+    def __truediv__(Matrix_gfpn_dense self, p):
         """
         Divide a matrix by a scalar.
 
diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx
index d274d9eec5..6c8e736e80 100644
--- a/src/sage/matroids/matroid.pyx
+++ b/src/sage/matroids/matroid.pyx
@@ -3784,18 +3784,6 @@ cdef class Matroid(SageObject):
         """
         return self.minor(contractions=X)
 
-    def __div__(self, X):
-        r"""
-        Shorthand for ``self.contract(X)``.
-
-        EXAMPLES::
-
-            sage: M = matroids.CompleteGraphic(4)
-            sage: M.contract(1) == M / 1  # indirect doctest
-            True
-        """
-        return self.contract(X)
-
     def __truediv__(self, X):
         r"""
         Shorthand for ``self.contract(X)``.
diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx
index 6e2c662476..f759d953d9 100644
--- a/src/sage/misc/lazy_import.pyx
+++ b/src/sage/misc/lazy_import.pyx
@@ -640,19 +640,6 @@ cdef class LazyImport(object):
         """
         return obj(left) @ obj(right)
 
-    def __div__(left, right):
-        """
-        TESTS::
-
-            sage: sage.all.foo = 10
-            sage: lazy_import('sage.all', 'foo')
-            sage: type(foo)
-            <type 'sage.misc.lazy_import.LazyImport'>
-            sage: foo / 2
-            5
-        """
-        return obj(left) / obj(right)
-
     def __floordiv__(left, right):
         """
         TESTS::
diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py
index 6c671e50f6..a9997770a0 100644
--- a/src/sage/misc/sage_input.py
+++ b/src/sage/misc/sage_input.py
@@ -1497,8 +1497,6 @@ class SageInputExpression(object):
         """
         return self._sie_binop('/', other)
 
-    __div__ = __truediv__
-
     def __add__(self, other):
         r"""
         Compute an expression tree for ``self + other``.
diff --git a/src/sage/modules/with_basis/indexed_element.pyx b/src/sage/modules/with_basis/indexed_element.pyx
index 4026f1947b..ad29f997e8 100644
--- a/src/sage/modules/with_basis/indexed_element.pyx
+++ b/src/sage/modules/with_basis/indexed_element.pyx
@@ -886,20 +886,6 @@ cdef class IndexedFreeModuleElement(ModuleElement):
         x_inv = B(x) ** -1
         return type(self)(F, scal(x_inv, D))
 
-    def __div__(left, right):
-        """
-        Forward old-style division to true division.
-
-        EXAMPLES::
-
-            sage: F = CombinatorialFreeModule(QQ, [1,2,3])
-            sage: x = F._from_dict({1:2, 2:3})
-            sage: x/2
-            B[1] + 3/2*B[2]
-        """
-        return left / right
-
-
 def _unpickle_element(C, d):
     """
     Unpickle an element in ``C`` given by ``d``.
diff --git a/src/sage/plot/colors.py b/src/sage/plot/colors.py
index 84da272fbb..9f12c0dbdb 100644
--- a/src/sage/plot/colors.py
+++ b/src/sage/plot/colors.py
@@ -801,7 +801,7 @@ class Color(object):
             RGB color (0.29166666666666663, 0.286437908496732, 0.07794117647058824)
             sage: vector((papayawhip / 2).rgb()) == vector((papayawhip * 0.5).rgb())
             True
-            sage: yellow.__div__(1/4)
+            sage: yellow.__truediv__(1/4)
             RGB color (0.0, 0.0, 0.0)
 
         TESTS::
@@ -822,27 +822,6 @@ class Color(object):
         """
         return self * (1 / float(right))
 
-    def __div__(self, right):
-        """
-        Return a color whose RGB coordinates are this color's
-        coordinates divided by a scalar.
-
-        INPUT:
-
-        - ``right`` -- a float-convertible, non-zero number
-
-        OUTPUT:
-
-        - a **new** instance of :class:`Color`
-
-        EXAMPLES::
-
-            sage: from sage.plot.colors import yellow
-            sage: yellow.__div__(4)
-            RGB color (0.25, 0.25, 0.0)
-        """
-        return self / right
-
     def __int__(self):
         """
         Return the integer representation of this colour.
diff --git a/src/sage/quivers/algebra_elements.pyx b/src/sage/quivers/algebra_elements.pyx
index 25968539fc..33f73a7820 100644
--- a/src/sage/quivers/algebra_elements.pyx
+++ b/src/sage/quivers/algebra_elements.pyx
@@ -1301,9 +1301,6 @@ cdef class PathAlgebraElement(RingElement):
             return sample._new_(homog_poly_scale((<PathAlgebraElement>self).data, x))
         raise TypeError("Don't know how to divide {} by {}".format(x, self))
 
-    def __div__(self, x):
-        return self / x
-
 ## Multiplication in the algebra
 
     cpdef _mul_(self, other):
diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py
index 9514b16c4b..ec301dd731 100644
--- a/src/sage/rings/asymptotic/growth_group.py
+++ b/src/sage/rings/asymptotic/growth_group.py
@@ -623,8 +623,8 @@ class Variable(CachedRepresentation, SageObject):
             ...
             TypeError: Cannot substitute in 1/x in
             <class 'sage.rings.asymptotic.growth_group.Variable'>.
-            > *previous* TypeError: unsupported operand type(s) for /:
-            'sage.rings.integer.Integer' and 'str'
+            > *previous* TypeError: unsupported operand parent(s) for /:
+            'Integer Ring' and '<class 'str'>'
             sage: Variable('1/x')._substitute_({'x': 0})
             Traceback (most recent call last):
             ...
diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx
index 108eb25989..748bdc0c24 100644
--- a/src/sage/rings/complex_mpc.pyx
+++ b/src/sage/rings/complex_mpc.pyx
@@ -1573,7 +1573,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
         mpc_norm(x.value, self.value, (<RealField_class>x._parent).rnd)
         return x
 
-    def __rdiv__(self, left):
+    def __rtruediv__(self, left):
         r"""
         Returns the quotient of ``left`` with ``self``, that is: ``left/self``
         as a complex number.
@@ -1586,7 +1586,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement):
 
             sage: MPC = MPComplexField()
             sage: a = MPC(2, 2)
-            sage: a.__rdiv__(MPC(1))
+            sage: a.__rtruediv__(MPC(1))
             0.250000000000000 - 0.250000000000000*I
             sage: MPC(1)/a
             0.250000000000000 - 0.250000000000000*I
diff --git a/src/sage/rings/complex_number.pyx b/src/sage/rings/complex_number.pyx
index 526f88d2fd..1e58da9183 100644
--- a/src/sage/rings/complex_number.pyx
+++ b/src/sage/rings/complex_number.pyx
@@ -836,7 +836,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
         mpfr_clear(right_nm)
         return x
 
-    def __rdiv__(self, left):
+    def __rtruediv__(self, left):
         r"""
         Returns the quotient of left with ``self``, that is:
 
@@ -851,7 +851,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement):
         EXAMPLES::
 
             sage: a = ComplexNumber(2,0)
-            sage: a.__rdiv__(CC(1))
+            sage: a.__rtruediv__(CC(1))
             0.500000000000000
             sage: CC(1)/a
             0.500000000000000
diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
index 624122569b..e59f099586 100644
--- a/src/sage/rings/integer.pyx
+++ b/src/sage/rings/integer.pyx
@@ -2012,7 +2012,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
             mpz_mul(x.value, self.value, (<Integer>right).value)
         return x
 
-    def __div__(left, right):
+    def __truediv__(left, right):
         r"""
         TESTS::
 
diff --git a/src/sage/rings/padics/lattice_precision.py b/src/sage/rings/padics/lattice_precision.py
index 6cb4f04d17..6e89a622b1 100644
--- a/src/sage/rings/padics/lattice_precision.py
+++ b/src/sage/rings/padics/lattice_precision.py
@@ -397,8 +397,6 @@ class pRational:
             val = self._valuation - other._valuation
         return self.__class__(self.p, self.x / other.x, self.exponent - other.exponent, valuation=val)
 
-    __div__ = __truediv__
-
     def _quo_rem(self, other):
         """
         Quotient with remainder.
diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx
index 924cc71986..b7f6ce35cd 100644
--- a/src/sage/rings/polynomial/polynomial_element.pyx
+++ b/src/sage/rings/polynomial/polynomial_element.pyx
@@ -2227,9 +2227,6 @@ cdef class Polynomial(CommutativeAlgebraElement):
         return wrapperdescr_fastcall(RingElement.__truediv__,
                 left, (right,), <object>NULL)
 
-    def __div__(left, right):
-        return PyNumber_TrueDivide(left, right)
-
     def __pow__(left, right, modulus):
         """
         EXAMPLES::
diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx
index 6a4b3eacb2..e922b82f8e 100644
--- a/src/sage/rings/rational.pyx
+++ b/src/sage/rings/rational.pyx
@@ -2403,7 +2403,7 @@ cdef class Rational(sage.structure.element.FieldElement):
             mpq_mul(x.value, self.value, (<Rational>right).value)
         return x
 
-    def __div__(left, right):
+    def __truediv__(left, right):
         """
         Return ``left`` divided by ``right``
 
diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
index 8399d8253b..1f8a9ce8c9 100644
--- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
+++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx
@@ -434,9 +434,6 @@ cdef class PeriodicRegion:
                             new_data[(a*rows+i)//n, (b*cols+j)//n] = data[i,j]
         return PeriodicRegion(self.w1, self.w2, new_data)
 
-    def __div__(self, other):
-        return self / other
-
     def __invert__(self):
         """
         Returns the complement of this region.
diff --git a/src/sage/structure/category_object.pyx b/src/sage/structure/category_object.pyx
index fdca7ec591..ec16091b33 100644
--- a/src/sage/structure/category_object.pyx
+++ b/src/sage/structure/category_object.pyx
@@ -895,32 +895,6 @@ cdef class CategoryObject(SageObject):
         """
         return dir_with_other_class(self, self.category().parent_class)
 
-    ##############################################################################
-    # For compatibility with Python 2
-    ##############################################################################
-    def __div__(self, other):
-        """
-        Implement Python 2 division as true division.
-
-        EXAMPLES::
-
-            sage: V = QQ^2
-            sage: V.__div__(V.span([(1,3)]))  # py2
-            Vector space quotient V/W of dimension 1 over Rational Field where
-            V: Vector space of dimension 2 over Rational Field
-            W: Vector space of degree 2 and dimension 1 over Rational Field
-            Basis matrix:
-            [1 3]
-            sage: V.__truediv__(V.span([(1,3)]))
-            Vector space quotient V/W of dimension 1 over Rational Field where
-            V: Vector space of dimension 2 over Rational Field
-            W: Vector space of degree 2 and dimension 1 over Rational Field
-            Basis matrix:
-            [1 3]
-        """
-        return self / other
-
-
 cpdef normalize_names(Py_ssize_t ngens, names):
     r"""
     Return a tuple of strings of variable names of length ngens given
diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx
index b1a64b9cbb..f190233b28 100644
--- a/src/sage/structure/element.pyx
+++ b/src/sage/structure/element.pyx
@@ -1606,77 +1606,6 @@ cdef class Element(SageObject):
         """
         return coercion_model.bin_op(self, n, mul)
 
-    def __div__(left, right):
-        """
-        Top-level division operator for :class:`Element` invoking
-        the coercion model. This is always true division.
-
-        See :ref:`element_arithmetic`.
-
-        EXAMPLES::
-
-            sage: 2 / 3
-            2/3
-            sage: pi / 3
-            1/3*pi
-            sage: K.<i> = NumberField(x^2+1)
-            sage: 2 / K.ideal(i+1)
-            Fractional ideal (-i + 1)
-
-        ::
-
-            sage: from sage.structure.element import Element
-            sage: class MyElement(Element):
-            ....:     def _div_(self, other):
-            ....:         return 42
-            sage: e = MyElement(Parent())
-            sage: e / e
-            42
-
-        TESTS::
-
-            sage: e = Element(Parent())
-            sage: e / e
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand parent(s) for /: '<sage.structure.parent.Parent object at ...>' and '<sage.structure.parent.Parent object at ...>'
-            sage: 1 / e
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand parent(s) for /: 'Integer Ring' and '<sage.structure.parent.Parent object at ...>'
-            sage: e / 1
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand parent(s) for /: '<sage.structure.parent.Parent object at ...>' and 'Integer Ring'
-            sage: int(1) / e
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand type(s) for /: 'int' and 'sage.structure.element.Element'
-            sage: e / int(1)
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand type(s) for /: 'sage.structure.element.Element' and 'int'
-            sage: None / e
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand type(s) for /: 'NoneType' and 'sage.structure.element.Element'
-            sage: e / None
-            Traceback (most recent call last):
-            ...
-            TypeError: unsupported operand type(s) for /: 'sage.structure.element.Element' and 'NoneType'
-        """
-        # See __add__ for comments
-        cdef int cl = classify_elements(left, right)
-        if HAVE_SAME_PARENT(cl):
-            return (<Element>left)._div_(right)
-        if BOTH_ARE_ELEMENT(cl):
-            return coercion_model.bin_op(left, right, truediv)
-
-        try:
-            return coercion_model.bin_op(left, right, truediv)
-        except TypeError:
-            return NotImplemented
-
     def __truediv__(left, right):
         """
         Top-level true division operator for :class:`Element` invoking
@@ -3425,9 +3354,6 @@ cdef class Vector(ModuleElement):
     cpdef _pairwise_product_(Vector left, Vector right):
         raise TypeError("unsupported operation for '%s' and '%s'"%(parent(left), parent(right)))
 
-    def __div__(self, other):
-        return self / other
-
     def __truediv__(self, right):
         right = py_scalar_to_element(right)
         if isinstance(right, RingElement):
@@ -3783,59 +3709,6 @@ cdef class Matrix(ModuleElement):
             return left * ~right
         return coercion_model.bin_op(left, right, truediv)
 
-    def __div__(left, right):
-        """
-        Division of the matrix ``left`` by the matrix or scalar ``right``.
-
-        EXAMPLES::
-
-            sage: a = matrix(ZZ, 2, range(4))
-            sage: a / 5
-            [ 0 1/5]
-            [2/5 3/5]
-            sage: a = matrix(ZZ, 2, range(4))
-            sage: b = matrix(ZZ, 2, [1,1,0,5])
-            sage: a / b
-            [  0 1/5]
-            [  2 1/5]
-            sage: c = matrix(QQ, 2, [3,2,5,7])
-            sage: c / a
-            [-5/2  3/2]
-            [-1/2  5/2]
-            sage: a / c
-            [-5/11  3/11]
-            [-1/11  5/11]
-            sage: a / 7
-            [  0 1/7]
-            [2/7 3/7]
-
-        Other rings work just as well::
-
-            sage: a = matrix(GF(3),2,2,[0,1,2,0])
-            sage: b = matrix(ZZ,2,2,[4,6,1,2])
-            sage: a / b
-            [1 2]
-            [2 0]
-            sage: c = matrix(GF(3),2,2,[1,2,1,1])
-            sage: a / c
-            [1 2]
-            [1 1]
-            sage: a = matrix(RDF,2,2,[.1,-.4,1.2,-.6])
-            sage: b = matrix(RDF,2,2,[.3,.1,-.5,1.3])
-            sage: a / b # rel tol 1e-10
-            [-0.15909090909090906 -0.29545454545454547]
-            [   2.863636363636364  -0.6818181818181817]
-            sage: R.<t> = ZZ['t']
-            sage: a = matrix(R,2,2,[t^2,t+1,-t,t+2])
-            sage: b = matrix(R,2,2,[t^3-1,t,-t+3,t^2])
-            sage: a / b
-            [      (t^4 + t^2 - 2*t - 3)/(t^5 - 3*t)               (t^4 - t - 1)/(t^5 - 3*t)]
-            [       (-t^3 + t^2 - t - 6)/(t^5 - 3*t) (t^4 + 2*t^3 + t^2 - t - 2)/(t^5 - 3*t)]
-        """
-        if have_same_parent(left, right):
-            return left * ~right
-        return coercion_model.bin_op(left, right, truediv)
-
     cdef _vector_times_matrix_(matrix_right, Vector vector_left):
         raise TypeError
 
diff --git a/src/sage/structure/factorization.py b/src/sage/structure/factorization.py
index b163e81a29..e50dc26a94 100644
--- a/src/sage/structure/factorization.py
+++ b/src/sage/structure/factorization.py
@@ -1173,8 +1173,6 @@ class Factorization(SageObject):
             return self / Factorization([(other, 1)])
         return self * other**-1
 
-    __div__ = __truediv__
-
     def value(self):
         """
         Return the product of the factors in the factorization, multiplied out.
diff --git a/src/sage/tensor/modules/comp.py b/src/sage/tensor/modules/comp.py
index dd28a630d2..ad60a401a9 100644
--- a/src/sage/tensor/modules/comp.py
+++ b/src/sage/tensor/modules/comp.py
@@ -1889,7 +1889,7 @@ class Components(SageObject):
             sage: from sage.tensor.modules.comp import Components
             sage: a = Components(QQ, [1,2,3], 1)
             sage: a[:] = 1, 0, -3
-            sage: s = a.__div__(3) ; s
+            sage: s = a.__truediv__(3) ; s
             1-index components w.r.t. [1, 2, 3]
             sage: s[:]
             [1/3, 0, -1]
@@ -1907,8 +1907,6 @@ class Components(SageObject):
             result._comp[ind] = val / other
         return result
 
-    __div__ = __truediv__
-
     def trace(self, pos1, pos2):
         r"""
         Index contraction.
diff --git a/src/sage/tensor/modules/free_module_tensor.py b/src/sage/tensor/modules/free_module_tensor.py
index daed9b8955..cdfe8f5f9d 100644
--- a/src/sage/tensor/modules/free_module_tensor.py
+++ b/src/sage/tensor/modules/free_module_tensor.py
@@ -2263,7 +2263,7 @@ class FreeModuleTensor(ModuleElement):
             sage: e = M.basis('e')
             sage: a = M.tensor((2,0), name='a')
             sage: a[:] = [[4,0], [-2,5]]
-            sage: s = a.__div__(4) ; s
+            sage: s = a.__truediv__(4) ; s
             Type-(2,0) tensor on the 2-dimensional vector space M over the
              Rational Field
             sage: s[:]
@@ -2280,8 +2280,6 @@ class FreeModuleTensor(ModuleElement):
             result._components[basis] = self._components[basis] / other
         return result
 
-    __div__ = __truediv__
-
     def __call__(self, *args):
         r"""
         The tensor acting on linear forms and module elements as a multilinear