gh-142419: Add mmap.set_name method for user custom annotation
- Issue: gh-142419
📚 Documentation preview 📚: https://cpython-previews--142480.org.readthedocs.build/
@picnixz @vstinner PTAL :)
@picnixz: What do you think of not adding cpython:mmap: prefix? set_name("abc") would sets the memory mapping name to [abc].
Personally, I think we should at least indicate cpython. As I don't have a kernel recent enough, I can't test this, but I guess that seeing "cpython" could help users grepping for whatever is related to cpython. I don't think we really need :mmap though but it could help distinguishing between what's been created from the interpreter directly and what's been created by a direct call to mmap. We could instead have cpython:<name> prefix for the interpreter and cpython:[<name>] for what's being used by mmap.
Is it because you're worried about the allowed length? or something else?
Personally, I think we should at least indicate cpython. As I don't have a kernel recent enough, I can't test this, but I guess that seeing "cpython" could help users grepping for whatever is related to cpython. I don't think we really need :mmap though but it could help distinguishing between what's been created from the interpreter directly and what's been created by a direct call to mmap. We could instead have cpython:
prefix for the interpreter and cpython:[ ] for what's being used by mmap.
@vstinner @picnixz
I still prefer to keep the current convention as much as possible. As Bénédikt mentioned, having a common prefix is important for filtering.
Regarding using different conventions for CPython-defined versus user-defined mappings, I would prefer not to introduce additional distinctions that people need to learn or interpret. Keeping things simple and consistent feels more important here.
For that reason, my preference is to maintain the same convention across the board.
If there is no strong objection with this, I hope that I can merge this PR soon.
Ok, let's add the cpython:mmap: prefix.
@picnixz I think that we are ready to land this feature :)