GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feat: locale-module by Yaminyam · Pull Request #4081 · RustPython/RustPython

Conversation

@Yaminyam

@Yaminyam Yaminyam commented Aug 16, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Snowapril reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Yaminyam
Feat: locale-module
e887804
@Yaminyam
Yaminyam marked this pull request as draft August 16, 2022 05:33
youknowone
youknowone reviewed Aug 16, 2022
View reviewed changes
Comment thread stdlib/src/locale.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Yaminyam and others added 4 commits August 16, 2022 16:09
@Yaminyam @youknowone
Update stdlib/src/locale.rs
d67719e
Co-authored-by: Jeong YunWon <[email protected]>
@Yaminyam
Fix: return type
2e886ff
@Yaminyam
Refactor: fmt
b11221e
@Yaminyam
Feat: localeconv
c0e4d2b
@youknowone youknowone added the z-ca-2022 Tag to track contrubution-academy 2022 label Aug 16, 2022
fanninpm
fanninpm reviewed Aug 22, 2022
View reviewed changes
Comment thread stdlib/src/locale.rs Outdated

#[pyfunction]
fn localeconv(vm: &VirtualMachine) -> PyResult<PyStrRef> {
let result = unsafe { libc::localeconv() };

@fanninpm fanninpm Aug 22, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current Windows version of the libc crate, this function and its return type are both missing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Yaminyam reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@fanninpm

fanninpm commented Aug 22, 2022

Copy link
Copy Markdown
Contributor

I don't think this particular module belongs in the stdlib crate:

>>> import _locale
>>> _locale.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module '_locale' has no attribute '__file__'. Did you mean: '__name__'?

I think it should belong in the vm crate instead. What do you think, @youknowone?

youknowone and Yaminyam reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone

youknowone commented Aug 25, 2022

Copy link
Copy Markdown
Member

@fanninpm Interesting. Does __file__ attribute existence different by it is builtin or not?

I usually check sys.builtin_module_names

>>> import sys
>>> sys.builtin_module_names
('_abc', '_ast', '_codecs', '_collections', '_functools', '_imp', '_io', '_locale', '_operator', '_signal', '_sre', '_stat', '_string', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', 'atexit', 'builtins', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'posix', 'pwd', 'sys', 'time', 'xxsubtype')
>>> '_locale' in sys.builtin_module_names
True

Yes, so this belongs in vm crate.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fanninpm

fanninpm commented Aug 25, 2022

Copy link
Copy Markdown
Contributor

Does __file__ attribute existence different by it is builtin or not?

Let's see:

>>> import argparse # pure-python module
>>> argparse.__file__
'/usr/lib/python3.10/argparse.py'
>>> import mmap # dynamically-linked c module
>>> mmap.__file__
'/usr/lib/python3.10/lib-dynload/mmap.cpython-310-x86_64-linux-gnu.so'
>>> import gc # statically-linked c module
>>> gc.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'gc' has no attribute '__file__'. Did you mean: '__name__'?

The Python docs say that the __file__ attribute is

The pathname of the file from which the module was loaded, if it was loaded from a file. The __file__ attribute may be missing for certain types of modules, such as C modules that are statically linked into the interpreter. For extension modules loaded dynamically from a shared library, it’s the pathname of the shared library file.

youknowone and Yaminyam reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone

youknowone commented Aug 25, 2022

Copy link
Copy Markdown
Member

Thanks! I didn't know that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Yaminyam added 2 commits August 28, 2022 14:59
@Yaminyam
Feat: setlocale
bf662c8
@Yaminyam
Fix: FromArgs
5639575
@youknowone youknowone mentioned this pull request Sep 12, 2022
Update locale lib, tests and Add locale.getencoding #4155
Closed
@youknowone

youknowone commented Mar 30, 2025

Copy link
Copy Markdown
Member

Thank you for contributing. This is not implemented by #4558

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone youknowone closed this Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone left review comments
@fanninpm fanninpm fanninpm left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

z-ca-2022 Tag to track contrubution-academy 2022

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Yaminyam @fanninpm @youknowone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.