Merge pull request #3162 from robhagemans/bugfix-ebdt-reversebytes
Bug fix for `TypeError` in `_reverseBytes()` in module `E_B_D_T_`, currently breaks on `bytes` arguments longer than 1
This commit is contained in:
commit
5c8bce194b
@ -258,7 +258,7 @@ def _memoize(f):
|
||||
class memodict(dict):
|
||||
def __missing__(self, key):
|
||||
ret = f(key)
|
||||
if len(key) == 1:
|
||||
if isinstance(key, int) or len(key) == 1:
|
||||
self[key] = ret
|
||||
return ret
|
||||
|
||||
@ -271,7 +271,13 @@ def _memoize(f):
|
||||
# opposite of what makes sense algorithmically and hence this function.
|
||||
@_memoize
|
||||
def _reverseBytes(data):
|
||||
if len(data) != 1:
|
||||
r"""
|
||||
>>> bin(ord(_reverseBytes(0b00100111)))
|
||||
'0b11100100'
|
||||
>>> _reverseBytes(b'\x00\xf0')
|
||||
b'\x00\x0f'
|
||||
"""
|
||||
if isinstance(data, bytes) and len(data) != 1:
|
||||
return bytesjoin(map(_reverseBytes, data))
|
||||
byte = byteord(data)
|
||||
result = 0
|
||||
|
21
README.rst
21
README.rst
@ -253,17 +253,16 @@ Acknowledgements
|
||||
In alphabetical order:
|
||||
|
||||
aschmitz, Olivier Berten, Samyak Bhuta, Erik van Blokland, Petr van Blokland,
|
||||
Jelle Bosma, Sascha Brawer, Tom Byrer, Antonio Cavedoni, Frédéric
|
||||
Coiffier, Vincent Connare, David Corbett, Simon Cozens, Dave Crossland,
|
||||
Simon Daniels, Peter Dekkers, Behdad Esfahbod, Behnam Esfahbod, Hannes
|
||||
Famira, Sam Fishman, Matt Fontaine, Takaaki Fuji, Yannis Haralambous, Greg
|
||||
Hitchcock, Jeremie Hornus, Khaled Hosny, John Hudson, Denis Moyogo Jacquerye,
|
||||
Jack Jansen, Tom Kacvinsky, Jens Kutilek, Antoine Leca, Werner Lemberg, Tal
|
||||
Leming, Peter Lofting, Cosimo Lupo, Olli Meier, Masaya Nakamura, Dave Opstad,
|
||||
Laurence Penney, Roozbeh Pournader, Garret Rieger, Read Roberts, Colin Rofls,
|
||||
Guido van Rossum, Just van Rossum, Andreas Seidel, Georg Seifert, Chris
|
||||
Simpkins, Miguel Sousa, Adam Twardoch, Adrien Tétar, Vitaly Volkov,
|
||||
Paul Wise.
|
||||
Jelle Bosma, Sascha Brawer, Tom Byrer, Antonio Cavedoni, Frédéric Coiffier,
|
||||
Vincent Connare, David Corbett, Simon Cozens, Dave Crossland, Simon Daniels,
|
||||
Peter Dekkers, Behdad Esfahbod, Behnam Esfahbod, Hannes Famira, Sam Fishman,
|
||||
Matt Fontaine, Takaaki Fuji, Rob Hagemans, Yannis Haralambous, Greg Hitchcock,
|
||||
Jeremie Hornus, Khaled Hosny, John Hudson, Denis Moyogo Jacquerye, Jack Jansen,
|
||||
Tom Kacvinsky, Jens Kutilek, Antoine Leca, Werner Lemberg, Tal Leming, Peter
|
||||
Lofting, Cosimo Lupo, Olli Meier, Masaya Nakamura, Dave Opstad, Laurence Penney,
|
||||
Roozbeh Pournader, Garret Rieger, Read Roberts, Colin Rofls, Guido van Rossum,
|
||||
Just van Rossum, Andreas Seidel, Georg Seifert, Chris Simpkins, Miguel Sousa,
|
||||
Adam Twardoch, Adrien Tétar, Vitaly Volkov, Paul Wise.
|
||||
|
||||
Copyrights
|
||||
~~~~~~~~~~
|
||||
|
Loading…
x
Reference in New Issue
Block a user