Skip to content

Commit fdc1d68

Browse files
committed
Fixed python 3 compatibility issue that only showed on windows
And bumped version to 0.6.2
1 parent b1c9d3e commit fdc1d68

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

gitdb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _init_externals():
2929
__author__ = "Sebastian Thiel"
3030
__contact__ = "[email protected]"
3131
__homepage__ = "https://github.com/gitpython-developers/gitdb"
32-
version_info = (0, 6, 1)
32+
version_info = (0, 6, 2)
3333
__version__ = '.'.join(str(i) for i in version_info)
3434

3535

gitdb/util.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import errno
1010

11-
from io import StringIO
11+
from io import BytesIO
1212

1313
from smmap import (
1414
StaticWindowMapManager,
@@ -78,14 +78,14 @@ def unpack_from(fmt, data, offset=0):
7878
#{ compatibility stuff ...
7979

8080

81-
class _RandomAccessStringIO(object):
81+
class _RandomAccessBytesIO(object):
8282

8383
"""Wrapper to provide required functionality in case memory maps cannot or may
8484
not be used. This is only really required in python 2.4"""
8585
__slots__ = '_sio'
8686

8787
def __init__(self, buf=''):
88-
self._sio = StringIO(buf)
88+
self._sio = BytesIO(buf)
8989

9090
def __getattr__(self, attr):
9191
return getattr(self._sio, attr)
@@ -130,7 +130,7 @@ def make_sha(source=''.encode("ascii")):
130130
def allocate_memory(size):
131131
""":return: a file-protocol accessible memory block of the given size"""
132132
if size == 0:
133-
return _RandomAccessStringIO('')
133+
return _RandomAccessBytesIO(b'')
134134
# END handle empty chunks gracefully
135135

136136
try:
@@ -140,7 +140,7 @@ def allocate_memory(size):
140140
# this of course may fail if the amount of memory is not available in
141141
# one chunk - would only be the case in python 2.4, being more likely on
142142
# 32 bit systems.
143-
return _RandomAccessStringIO("\0" * size)
143+
return _RandomAccessBytesIO(b"\0" * size)
144144
# END handle memory allocation
145145

146146

@@ -169,7 +169,7 @@ def file_contents_ro(fd, stream=False, allow_mmap=True):
169169
# read manully
170170
contents = os.read(fd, os.fstat(fd).st_size)
171171
if stream:
172-
return _RandomAccessStringIO(contents)
172+
return _RandomAccessBytesIO(contents)
173173
return contents
174174

175175

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def get_data_files(self):
7777
__author__ = "Sebastian Thiel"
7878
__contact__ = "[email protected]"
7979
__homepage__ = "https://github.com/gitpython-developers/gitdb"
80-
version_info = (0, 6, 1)
80+
version_info = (0, 6, 2)
8181
__version__ = '.'.join(str(i) for i in version_info)
8282

8383
setup(cmdclass={'build_ext': build_ext_nofail},
@@ -92,8 +92,8 @@ def get_data_files(self):
9292
ext_modules=[Extension('gitdb._perf', ['gitdb/_fun.c', 'gitdb/_delta_apply.c'], include_dirs=['gitdb'])],
9393
license = "BSD License",
9494
zip_safe=False,
95-
requires=('smmap (>=0.8.3)', ),
96-
install_requires=('smmap >= 0.8.3'),
95+
requires=('smmap (>=0.8.5)', ),
96+
install_requires=('smmap >= 0.8.5'),
9797
long_description = """GitDB is a pure-Python git object database""",
9898
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
9999
classifiers=[

0 commit comments

Comments
 (0)