Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pybase64 returns invalid results on Windows #8

Closed
GeorgeFischhof opened this issue Aug 30, 2017 · 5 comments · Fixed by aklomp/base64#42
Closed

pybase64 returns invalid results on Windows #8

GeorgeFischhof opened this issue Aug 30, 2017 · 5 comments · Fixed by aklomp/base64#42
Labels
Milestone

Comments

@GeorgeFischhof
Copy link

pybase64 encode created not base64 encoded stream

Hi there,

I wanted to encode an image:

import requests
import pybase64

image_url = 'http://www.123freeicons.com/wp-content/uploads/Images/Nature/003-tick-weather-icons-l.jpg'
image = requests.get(image_url).content
image_base64 = pybase64.b64encode(image)

the returned stream contained non ascii characters. Maybe "just" encode and decode are exchanged (I did not try). But the same behaviour is found when used standrad or url_safe encoding.

used:
windows 7 64 bit, Python 3.6.1 64 bit
4 cores cpu

checked standard lib, it created good base64 encoding

BR,
George

@mayeut
Copy link
Owner

mayeut commented Aug 30, 2017

Thanks for the report @GeorgeFischhof.

It's weird that this issue got past the CI testing setup (which includes comparison of the output between the standard library and pybase64).

I don't have a Windows setup at hand right now to investigate this. I'll check this once I get home tonight, GMT+2.

In the meantime, can you provide me with the CPU name and the version of pybase64 you're using ?

CPU name: from a command prompt, wmic cpu get name

Version of pybase64: how was it installed ? with pip or from sources ?

Again, thanks for the report.

@GeorgeFischhof
Copy link
Author

GeorgeFischhof commented Aug 30, 2017 via email

@mayeut mayeut added the bug label Aug 30, 2017
mayeut added a commit that referenced this issue Aug 31, 2017
Tests were run from the source folder which doesn’t have the C
extension built.
This lead to #8
@mayeut
Copy link
Owner

mayeut commented Aug 31, 2017

CI setup was not testing properly the wheels that were built. Once that was fixed I spent sometime to get it working on AppVeyor.

The 7737893 commit shall fix the issue you're seeing.

There were 2 issues:

  1. SIMD does not work correctly under Windows. This was easy to reproduce on my VM and looks like what you're reporting. I disabled SIMD on Windows for now. I will need to open a PR in libbase64 project later this week.

  2. I had another test failing only on CI builds. After much more investigation, this seems like a compiler issue. I modified a bit the way the code is written to work around this.

I will wait for the end of the week or for SIMD to be working before releasing to pypi. Whichever comes first.

In the meantime, you can test with this wheel if you're willing to give it a go: https://ci.appveyor.com/api/buildjobs/0x2jn1ktj0vs59ih/artifacts/todeploy%2Fpybase64-0.2.0-cp36-cp36m-win_amd64.whl

@GeorgeFischhof
Copy link
Author

GeorgeFischhof commented Aug 31, 2017 via email

mayeut added a commit to mayeut/base64 that referenced this issue Aug 31, 2017
Conditional code is now only dependent on config.h values in codecs
except for NEON which also includes the same checks as in codec_choose.
This fixes mayeut/pybase64#8 and probably aklomp#40
@mayeut mayeut changed the title pybase64 encode created not base64 encoded stream pybase64 returns invalid results on Windows Sep 3, 2017
@mayeut mayeut added this to the v0.2.1 milestone Sep 3, 2017
@mayeut
Copy link
Owner

mayeut commented Sep 3, 2017

I just released a new version (0.2.1).
It's available through pip.
I worked around the SIMD issue with libbase64 so that SIMD is enabled on Windows builds as well.
I added tests for all SIMD path in CI (AVX & AVX2 don't always run depending on which hardware is running the tests)

@mayeut mayeut closed this as completed Sep 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants