Describe the feature
Though the function in question, introduced in Python 3.12, is documented not to be available on all implementations of Python, I believe it to be relatively straightforward to implement when GraalPy already supports frames.
Expected behavior
There would be a function named _getframemodulename, available in the sys module, that would return the name of the module from which it was called by default, or the module of the caller n frames up if the sole argument depth is passed, or None if the module name cannot be determined.
Additional context
As demonstrated in the Python 3.14.6 coloured REPL:
Python 3.14.6 (tags/v3.14.6:c63aec6, Jun 10 2026, 10:26:10) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import _getframemodulename
>>> for i in range(7): print(i, _getframemodulename(i))
...
0 __main__
1 _pyrepl.console
2 _pyrepl.console
3 code
4 _pyrepl.simple_interact
5 _pyrepl.main
6 None
Describe the feature
Though the function in question, introduced in Python 3.12, is documented not to be available on all implementations of Python, I believe it to be relatively straightforward to implement when GraalPy already supports frames.
Expected behavior
There would be a function named
_getframemodulename, available in thesysmodule, that would return the name of the module from which it was called by default, or the module of the callernframes up if the sole argumentdepthis passed, orNoneif the module name cannot be determined.Additional context
As demonstrated in the Python 3.14.6 coloured REPL: