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

Fix parsing of variable without a value #158

Merged
merged 1 commit into from
Dec 14, 2018

Conversation

bbc2
Copy link
Collaborator

@bbc2 bbc2 commented Dec 14, 2018

In Python, \s also matches newlines. This would cause newlines to be
consumed by the equal sign matcher, resulting in the next line being
considered as a value.

For instance, the following would be parsed as [("FOO", "BAR=b")]
instead of [("FOO", ""), ("BAR", "b")].

FOO=
BAR=b

Fixes #157.

In Python, `\s` also matches newlines.  This would cause newlines to be
consumed by the equal sign matcher, resulting in the next line being
considered as a value.

For instance, the following would be parsed as `[("FOO", "BAR=b")]`
instead of [("FOO", ""), ("BAR", "b")].

```bash
FOO=
BAR=b
```

Fixes theskumar#157.
@bbc2 bbc2 requested a review from theskumar December 14, 2018 08:36
@coveralls
Copy link

Coverage Status

Coverage remained the same at 90.244% when pulling 921cc99 on bbc2:fix-empty-var-bug into 3daef30 on theskumar:master.

@theskumar
Copy link
Owner

This Looks good to me. Thanks for the quick fix!!

@theskumar theskumar merged commit 1f97377 into theskumar:master Dec 14, 2018
@bbc2 bbc2 deleted the fix-empty-var-bug branch December 23, 2018 17:32
johnbergvall pushed a commit to johnbergvall/python-dotenv that referenced this pull request Aug 13, 2021
In Python, `\s` also matches newlines.  This would cause newlines to be
consumed by the equal sign matcher, resulting in the next line being
considered as a value.

For instance, the following would be parsed as `[("FOO", "BAR=b")]`
instead of [("FOO", ""), ("BAR", "b")].

```bash
FOO=
BAR=b
```

Fixes theskumar#157.
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