Skip to content

Commit

Permalink
Remove hard-coded BytesCollection encoding (#1057)
Browse files Browse the repository at this point in the history
* Remove hard-coded BytesCollection encoding

Towards resolving #1048

* Pass encoding keyword arg in test

* Update change log
  • Loading branch information
sgillies authored Jan 31, 2022
1 parent c4ec419 commit 9925896
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Changes:

- Upgrade attrs, cython, etc to open up Python 3.10 support (#1049).

Bug fixes:

- Hard-coded "utf-8" collection encoding added in #423 has been removed
(#1057).

1.8.20 (2021-05-31)
-------------------

Expand Down
3 changes: 1 addition & 2 deletions fiona/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ def __init__(self, bytesbuf, **kwds):
self.virtual_file = buffer_to_virtual_file(self.bytesbuf, ext=ext)

# Instantiate the parent class.
super(BytesCollection, self).__init__(self.virtual_file, vsi=filetype,
encoding='utf-8', **kwds)
super(BytesCollection, self).__init__(self.virtual_file, vsi=filetype, **kwds)

def close(self):
"""Removes the virtual file associated with the class."""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bytescollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestReading(object):
def bytes_collection_object(self, path_coutwildrnp_json):
with open(path_coutwildrnp_json) as src:
bytesbuf = src.read().encode('utf-8')
self.c = fiona.BytesCollection(bytesbuf)
self.c = fiona.BytesCollection(bytesbuf, encoding="utf-8")
yield
self.c.close()

Expand Down

0 comments on commit 9925896

Please sign in to comment.