Skip to content

Commit

Permalink
Correct Python to Godot string conversion to avoid useless intermedia…
Browse files Browse the repository at this point in the history
…ry encoding in `_load_singleton`
  • Loading branch information
touilleMan committed Dec 26, 2024
1 parent c6d7ff0 commit 1ea1cc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/godot/classes.pyx.j2
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ cdef object _load_singleton(str name):

cdef object cls = _load_class(name)
{# cdef GDExtensionObjectPtr gdobj = pythonscript_gdextension.global_get_singleton(&(<StringName>cls._gd_name)._gd_data) #}
cdef gd_string_name_t gdname = gd_string_name_from_utf8(name.encode())
cdef gd_string_name_t gdname = gd_string_name_from_unchecked_pystr(name)
cdef GDExtensionObjectPtr gdobj = pythonscript_gdextension.global_get_singleton(&gdname)
gd_string_name_del(&gdname)
cdef object singleton = cls._from_ptr(<size_t>gdobj)
Expand Down

0 comments on commit 1ea1cc6

Please sign in to comment.