cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-142419: Add mmap.set_name method for user custom annotation

Open corona10 opened this issue 2 weeks ago • 5 comments

  • Issue: gh-142419

📚 Documentation preview 📚: https://cpython-previews--142480.org.readthedocs.build/

corona10 avatar Dec 09 '25 17:12 corona10

@picnixz @vstinner PTAL :)

corona10 avatar Dec 10 '25 17:12 corona10

@picnixz: What do you think of not adding cpython:mmap: prefix? set_name("abc") would sets the memory mapping name to [abc].

vstinner avatar Dec 13 '25 13:12 vstinner

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?

picnixz avatar Dec 13 '25 13:12 picnixz

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.

corona10 avatar Dec 14 '25 10:12 corona10

Ok, let's add the cpython:mmap: prefix.

vstinner avatar Dec 15 '25 12:12 vstinner

@picnixz I think that we are ready to land this feature :)

corona10 avatar Dec 17 '25 15:12 corona10