Skip to content

Commit

Permalink
Fix invalid auto_int value error when --umask=0 passed (#1632)
Browse files Browse the repository at this point in the history
Fixes #1622
  • Loading branch information
hramezani authored and berkerpeksag committed Oct 28, 2017
1 parent a3e258f commit 90b7dae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def make_settings(ignore=None):


def auto_int(_, x):
if x.startswith('0') and not x.lower().startswith('0x'):
# for compatible with octal numbers in python3
# for compatible with octal numbers in python3
if re.match(r'0(\d)', x, re.IGNORECASE):
x = x.replace('0', '0o', 1)
return int(x, 0)

Expand Down
4 changes: 3 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ def test_reload(options, expected):


@pytest.mark.parametrize("options, expected", [
(["--umask 0", "myapp:app"], 0),
(["--umask", "0", "myapp:app"], 0),
(["--umask", "0o0", "myapp:app"], 0),
(["--umask", "0x0", "myapp:app"], 0),
(["--umask", "0xFF", "myapp:app"], 255),
(["--umask", "0022", "myapp:app"], 18),
])
Expand Down

0 comments on commit 90b7dae

Please sign in to comment.