Skip to content

Commit 46df188

Browse files
Merge pull request #180 from pypa/hotfix/issue-179
Fix unicode handling for version_scheme
2 parents 28502bf + 0389d40 commit 46df188

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

setuptools_scm/version.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ def _warn_if_setuptools_outdated():
2222

2323
def callable_or_entrypoint(group, callable_or_name):
2424
trace('ep', (group, callable_or_name))
25-
if isinstance(callable_or_name, str):
26-
for ep in iter_entry_points(group, callable_or_name):
27-
trace("ep found:", ep.name)
28-
return ep.load()
29-
else:
25+
26+
if callable(callable_or_name):
3027
return callable_or_name
3128

29+
for ep in iter_entry_points(group, callable_or_name):
30+
trace("ep found:", ep.name)
31+
return ep.load()
32+
3233

3334
def tag_to_version(tag):
3435
trace('tag', tag)

testing/test_git.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ def test_version_from_git(wd):
3939
assert wd.version.startswith('0.2')
4040

4141

42+
@pytest.mark.issue(179)
43+
def test_unicode_version_scheme(wd):
44+
scheme = b'guess-next-dev'.decode('ascii')
45+
assert wd.get_version(version_scheme=scheme)
46+
47+
4248
@pytest.mark.issue(108)
4349
@pytest.mark.issue(109)
4450
def test_git_worktree(wd):

0 commit comments

Comments
 (0)