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

os.path: refactor: use sep instead of literal / #730

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scivision
Copy link
Contributor

No description provided.

Signed-off-by: Michael Hirsch <michael@scivision.dev>
@dpgeorge
Copy link
Member

dpgeorge commented Oct 4, 2023

Thanks for the contribution. Can you please explain what prompted this change and why it's better this way?

Copy link
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

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

Change LGTM apart from one small fix needed. However like @dpgeorge I'm curious what the motivation for making it was. (Windows, maybe?)

return s


def join(*args):
# TODO: this is non-compliant
if type(args[0]) is bytes:
return b"/".join(args)
return bytes(sep).join(args)
Copy link
Contributor

Choose a reason for hiding this comment

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

This line will raise an exception:

MicroPython v1.20.0-330-g076bfc7ed8-dirty on 2023-09-26; linux [GCC 13.2.1] version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> bytes("/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: string argument without an encoding
>>> "/".encode()
b'/'

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

Successfully merging this pull request may close these issues.

None yet

3 participants