Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale support including _locale and time.tzname #3850

Open
2 tasks
youknowone opened this issue Jul 8, 2022 · 7 comments
Open
2 tasks

locale support including _locale and time.tzname #3850

youknowone opened this issue Jul 8, 2022 · 7 comments
Labels

Comments

@youknowone
Copy link
Member

youknowone commented Jul 8, 2022

  • _locale module
  • time.tzname
@bonjune
Copy link
Contributor

bonjune commented Nov 2, 2022

https://docs.python.org/3/library/time.html#time.tzname

The doc says tzname is determined at module load time. Does "module load time" mean those values to be initialized in the function below?

pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
let module = time::make_module(vm);
#[cfg(unix)]
unix::extend_module(vm, &module);
#[cfg(windows)]
windows::extend_module(vm, &module);
module
}

@bonjune
Copy link
Contributor

bonjune commented Nov 2, 2022

#4054

If we are talking about holding states such as tzname (which is initialized at module load time), this can be related.

@youknowone
Copy link
Member Author

The doc says tzname is determined at module load time. Does "module load time" mean those values to be initialized in the function below?

It may not be exactly, but you can regard it is.

@youknowone
Copy link
Member Author

And yes. #4054 is generally related to module attributes and hidden data like Info types in sys module.

@JazzGlobal
Copy link
Contributor

Noticed quite a few functions in CPython Locale are not implemented in locale.rs. I don't have much experience with this type of work but would the general idea be to write a wrapper for say: GetLocaleIInfoA since it is used throughout CPython's implementation of getdefaultlocale so it can be used in our implementation?

@DimitrisJim
Copy link
Member

You are on Windows right? I haven't looked into how CPython does it (am out atm) but if this is calling some os provided function then yes, we typically wrap it and call into it after converting the args.

The function to be wrapped should be in windows.rs?

@JazzGlobal
Copy link
Contributor

JazzGlobal commented Apr 18, 2023

That's right, and gotcha. Looks like libc has bindings for setlocale but that's all im seeing

EDIT: Not all obviously, but no binding for getlocale .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants