Is GLib.get_real_name() cached?

Hi, I wonder if the result of GLib.get_real_name() is cached for some reason. If it’s cached on purpose, how could I get the latest value?

$ flatpak run --command=python3 --runtime=org.gnome.Sdk --runtime-version=master org.gnome.Calendar 
Python 3.7.4 (default, Nov 10 2011, 15:00:00) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GLib
>>> GLib.get_real_name()
'Foo'
>>> GLib.get_real_name()
'Foo'

Between the two calls, I changed the user name from “Foo” to “Bar” in Settings. I see the change applied in the /etc/passwd file too, but I don’t see a way to obtain the latest value from Python.

Yes: https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gutils.c#L603

(notice the g_once_init_enter()/g_once_init_leave())

Ah thanks. Then this isn’t specifig to the language binding. And I can’t use this GLib function for what I’m trying to do.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.