Python deleting objects with duplicate location?
Be wary, ob.location is a reference to objects data

Use a copy of an objects location to your tmp list tmp.append(ob.location.copy()), otherwise you are keeping a reference to an object you may* be deleting. (Which crashes blender).  Will point out this isn't the case in the logic of question script

A simple script to demonstrate.

import bpy
ob = bpy.context.object
tmp = []
tmp.append(ob.location)
ob.location = (10, 10, 10)
print(tmp)


will always print [Vector((10.0, 10.0, 10.0))]

import bpy
from bpy import context

selected = context.selected_objects
scene = context.scene
tmp = []
for ob in selected:
    if ob.location in tmp:
       scene.objects.unlink(ob)
       # do_unlink to be sure to be sure
       bpy.data.objects.remove(ob, do_unlink=True)
    else:
       tmp.append(ob.location.copy())



Might also pay to check that (u-v).length &lt; TOL where u is location of current obj, and v is each vector in the list, rather than trusting location in list.  On a few tests with duped cube works ok without...


Script below uses tolerance on each objects matrix_world.translation for global location.  It sorts the selected object list by this vector, rather than checking against another list every iteration.

import bpy

context = bpy.context

TOL = 0.00001
obs = sorted((o for o in context.selected_objects), key=lambda o: o.matrix_world.translation)
obs[0].select = False
for i in range(1, len(obs)):
    o = obs[i].matrix_world.translation
    p = obs[i-1].matrix_world.translation
    obs[i].select = (o - p).length &lt; TOL