What's wrong with the merging sort of Python?

there is no problem with the exact same logic under CPP. Python reports
RecursionError: maximum recursion depth exceeded in comparison

.
    
def merge(a:list, start:int, end:int, mid:int):
    t=deepcopy(a)
    i=start
    j=mid
    k=start
    while i<mid and j<end:
        if(t[i]>t[j]):
            a[k]=t[j]
            k+=1
            j+=1
        else:
            a[k]=t[i]
            i+=1
            k+=1
    while i<mid:
        a[k]=t[i]
        i+=1
        k+=1
    while j<end:
        a[k]=t[j]
        j+=1
        k+=1

    def merge_sort(a:list, start:int, end:int):
        if start<(end-1):
            mid=(end-start)//2
            merge_sort(a, start,mid)
            merge_sort(a, mid, end)
            merge(a, start, end, mid)


May.26,2021

the number of recursive layers exceeds the default. Set

import sys 
sys.setrecursionlimit(1000000)

def sort_arr(arr):
  while len(arr) > 1:
    -sharp 
    arr = [
      sort_arrs(arr[i], arr[i + 1] if i < len(arr) - 1 else [])
      for i in range(0, len(arr), 2)
    ]
  -sharp 
  return arr[0]


def sort_arrs(arr1, arr2=None):
  -sharp  [1, 2, 3] 
  -sharp  [[1], [2], [3]] 
  if isinstance(arr1, int):
    arr1 = [arr1]
  if isinstance(arr2, int):
    arr2 = [arr2]
  if not arr2:
    return arr1
  res = []
  index = 0
  for item in arr1:
    while index < len(arr2):
      if item < arr2[index]:
        break
      res.append(arr2[index])
      index += 1
    res.append(item)
  res.extend(arr2[index:])
  return res


print sort_arr([12, 23, 1, 44, 233, 10, 9, 8, 0])

find out what's wrong.
should be

when calculating mid
mid=(end+start)//2

the plus sign is written as a minus sign here

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e458be-4387b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e458be-4387b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?