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

Empty table key should be allowed #39

Closed
pwwang opened this issue May 6, 2022 · 8 comments
Closed

Empty table key should be allowed #39

pwwang opened this issue May 6, 2022 · 8 comments

Comments

@pwwang
Copy link
Contributor

pwwang commented May 6, 2022

>>> import tomli
>>> tomli.loads('"" = "abc"')
{'': 'abc'}
>>> import rtoml
>>> rtoml.loads('"" = "abc"')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    rtoml.loads('"" = "abc"')
  File "/path/to/python3.9/site-packages/rtoml/__init__.py", line 34, in
 loads
    return _rtoml.deserialize(toml)
_rtoml.TomlParsingError: empty table key found at line 1 column 1

Reference:

https://github.com/pwwang/toml-bench#testcompliancevalid

@samuelcolvin
Copy link
Owner

Thanks, I'll have a look. Might be a problem with the rust-toml library.

@samuelcolvin
Copy link
Owner

Ignore that, looks like it was fixed in toml-rs/toml-rs#373.

Updating to use the latest version of toml-rs should fix this.

Will do soon, or PR welcome.

@samuelcolvin
Copy link
Owner

Package is updated, I'd love to new benchmarks with v0.8.

@pwwang
Copy link
Contributor Author

pwwang commented May 12, 2022

I have updated https://github.com/pwwang/toml-bench to 0.0.3 with rtoml 0.8

@samuelcolvin
Copy link
Owner

Amazing, thanks so much.

@pwwang
Copy link
Contributor Author

pwwang commented May 12, 2022

@samuelcolvin Thank you for making rtoml available in python.

It's my favorite toml package in python now and I have been replacing other toml packages with rtoml in my projects. Not only because of its speed but your attitude toward keeping interpreting None to "null" (#31 (comment)), which gives us the opportunity to trace all the keys.

Looking forward to this implementation: #23 (comment)

@samuelcolvin
Copy link
Owner

No problem.

PR welcome if you're like to implement that.

I assume the PR open now does not work for you?

@pwwang
Copy link
Contributor Author

pwwang commented May 12, 2022

Ah, was misled by the title. #31 sounds good. I will make some comments there.

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

No branches or pull requests

2 participants