-
Notifications
You must be signed in to change notification settings - Fork 28
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
DeprecationWarning: integer argument expected, got float #79
Comments
I was unable to reproduce with Do you have a full traceback? These can be extracted by converting warnings to errors with some magical (It would be kind of ironic to see |
I'm working in a branch to fix #78, and one of the things I did was convert it to use I don't have a traceback yet but I'll try to get one. |
This is in the |
D'oh. I don't know why I had the impression that |
We're provoking the warning as a side-effect of test cases that ensure we can't put float values in X[LI]BTree objects.
On Python 3, that immediately raises a Objects of types with Could we replace the pack/unpack/equality check with something like:
That looks to be pretty comparable to what the C code does using |
All unit tests pass under PyPy, Py36, Py37, Py27, and Py27-pure with that change. |
Fixes #79 Slightly faster on CPython: $ python -m perf timeit -s 'from struct import Struct; s = Struct("i"); unpack=s.unpack; pack=s.pack' 'unpack(pack(123456))' ..................... Mean +- std dev: 252 ns +- 12 ns $ python -m perf timeit -s 'from struct import Struct; s = Struct("i"); from operator import index; pack=s.pack' 'pack(index(123456))' ..................... Mean +- std dev: 235 ns +- 6 ns Very slightly faster on PyPy: python -m perf timeit -s 'from struct import Struct; s = Struct("i"); unpack=s.unpack; pack=s.pack' 'unpack(pack(123456))' ......... Mean +- std dev: 4.24 ns +- 0.12 ns $ python -m perf timeit -s 'from struct import Struct; s = Struct("i"); from operator import index; pack=s.pack' 'pack(index(123456))' ......... Mean +- std dev: 4.19 ns +- 0.10 ns
Seen during test runs under Python 2
The text was updated successfully, but these errors were encountered: