**System Information**
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.30
**Blender Version**
Broken: version: 2.83 (sub 2), branch: master, commit date: 2020-02-09 16:59, hash: `rB5314161491d4`
**Short description of error**
Joining objects while iterating over a collection of objects, e.g. `bpy.context.view_layer.objects` or `bpy.context.scene.objects`, results in a crash.
I'm not entirely sure if this is supposed to work, since the collection that is being iterated over is modified inside the loop, which is rarely a good thing. It's very similar to T60491 which was closed because it couldn't be reproduced.
**Exact steps for others to reproduce the error**
# Open the attached blend file
# Run the script
{F8331656}
```
import bpy
for obj in bpy.context.view_layer.objects:
bpy.ops.object.select_all(action='SELECT')
bpy.context.view_layer.objects.active = obj
bpy.ops.object.join()
```