Comments (10)
Ah that's 32-bit Python on a 64-bit system I think? I won't be able to help more but for completeness, my Python installation was 64 bit.
from msgspec.
Thanks for the kind words, and glad you've figured out the issue. I've added a check for this in #696 that should prevent anyone else from trying to build msgspec
on 32-bit windows in the future.
from msgspec.
I have a similar-ish computer available and can't recreate the issue. Interested
>>> import json
>>> import msgspec
>>> x = '{"a": 3322.1755149730398}'
>>> msgspec.json.decode(x)
{'a': 3322.1755149730398}
python: 3.8.10
machine: AMD64
processor: Intel64 Family 6 Model 141 Stepping 1, GenuineIntel
system: Windows
release: 10
libc: ('', '')
byteorder: little
from msgspec.
Installed via pip. I don't know if it was a prebuilt as I just updated my venv to 3.11, upgraded pip wheel and setuptools, re-installed msgspec and it's now working.....Very strange. Let me see if I can go back and get specific builtins versions....Will update shortly.
from msgspec.
Thanks for opening this. I'm unable to reproduce the issue, I suspect this is platform specific. Here's what I see on an x86 linux machine:
In [1]: import msgspec
In [2]: msg = '{"a": 3322.1755149730398}'
In [3]: msgspec.json.decode(msg)
Out[3]: {'a': 3322.1755149730398}
Can you provide some extra platform information (OS, hardware, etc...)? The following script should output some relevant info:
import platform
import sys
uname = platform.uname()
print(f"python: {platform.python_version()}")
for attr in ["machine", "processor", "system", "release"]:
print(f"{attr}: {getattr(uname, attr)}")
print(f"libc: {platform.libc_ver()}")
print(f"byteorder: {sys.byteorder}")
from msgspec.
python: 3.8.10
machine: AMD64
processor: Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
system: Windows
release: 10
libc: ('', '')
byteorder: little
from msgspec.
Hmmm, we do test on a platform that should be similar enough to this one to catch errors. A few more questions:
- How did you install
msgspec
? Did you install it withpip
from pypi? Using conda? Something else? - Do you know if you used a prebuilt wheel for your platform (as available on pypi or through conda), or did you compile it yourself from source?
from msgspec.
OK, reproduced with the following details. Let me know if there's anything else I can provide to track this down.
python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:34:34) [MSC v.1928 32 bit (Intel)] on win32
py -m pip --version
pip 21.1.1 from C:\Users\<name>\Documents\deployment scripts\venv\lib\site-packages\pip (python 3.8)
easy_install --version
setuptools 47.1.0 from c:\program files (x86)\python37-32\lib\site-packages (Python 3.7)
dist-info/WHEEL:
Wheel-Version: 1.0
Generator: bdist_wheel (0.43.0)
Root-Is-Purelib: false
Tag: cp38-cp38-win32
dist-info/RECORD:
msgspec-0.18.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
msgspec-0.18.6.dist-info/LICENSE,sha256=b96LZyOIXoUIgI9lrDcv65fT7uLqsrkdNNeWt1t6xzQ,1498
msgspec-0.18.6.dist-info/METADATA,sha256=g0eKS6M3Jb387PXe1j1Z60C6LZnUW5d1cCuHc72k9-k,7082
msgspec-0.18.6.dist-info/RECORD,,
msgspec-0.18.6.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
msgspec-0.18.6.dist-info/WHEEL,sha256=57hb2VMKfzdcZEFKIri3BxIFhvran9ahu4uVnDJqFIU,96
msgspec-0.18.6.dist-info/top_level.txt,sha256=8Ysnxa29QLhdPtjPGjyc1hmx3nOmKeu_OAk2682ZdvU,8
msgspec/__init__.py,sha256=4QmZjYKuUQHkpu3H1x4ts2Sg5qcdtiDeo9Gajv4CwPs,1156
msgspec/__init__.pyi,sha256=aUYA7Kox-fxletfoPoVU_HZod3D5lJxzpjLQtZFV2lM,6081
msgspec/__pycache__/__init__.cpython-38.pyc,,
msgspec/__pycache__/_json_schema.cpython-38.pyc,,
msgspec/__pycache__/_utils.cpython-38.pyc,,
msgspec/__pycache__/_version.cpython-38.pyc,,
msgspec/__pycache__/inspect.cpython-38.pyc,,
msgspec/__pycache__/json.cpython-38.pyc,,
msgspec/__pycache__/msgpack.cpython-38.pyc,,
msgspec/__pycache__/structs.cpython-38.pyc,,
msgspec/__pycache__/toml.cpython-38.pyc,,
msgspec/__pycache__/yaml.cpython-38.pyc,,
msgspec/_core.cp38-win32.pyd,sha256=KPEtoqCgZa_KJEFZTmChEcG3Ln676j394LhdYNTKH84,291328
msgspec/_json_schema.py,sha256=bKTi8sOiBuNyEUGJhrjnX4rUhYdjK09MtcDgU8mEo1E,16658
msgspec/_utils.py,sha256=HCvPg_NzLvFpx5SlwnC9SwoYt2UQhldruxG_Ss7RgQA,9048
msgspec/_version.py,sha256=a2wg-8U8xWqU9IRC7WiyOCpBPUcpPFYKTgfQEYpqbZ0,519
msgspec/inspect.py,sha256=uHY4bwjrfNE4UP6rU1PwaZ3-QeyClw-5hpWyXIuFhq4,28896
msgspec/json.py,sha256=kIzpm2NHszkAfAbNcemxq_hUHKt3qxH29yABKH0MnTs,212
msgspec/json.pyi,sha256=-TbORmV1rciB3vMPed-8OPF7Au1_e2fF1iMEQFiAkzY,2995
msgspec/msgpack.py,sha256=JSRLcEqpyCgwy_wD1loF3qHN_ytnCQLc8RX33uATbCU,154
msgspec/msgpack.pyi,sha256=_NpTS8XnjP4ELvqeY-qYWRrsAJi5cvPad7DYICGM3Dw,2566
msgspec/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
msgspec/structs.py,sha256=owU3O3w8yi4_lQYAHIRwM0Hre0Oo_puNbz4SM0GP0ew,2942
msgspec/structs.pyi,sha256=6ob7yIjD6QwMUn_vJHC0CgWgt3CtgRAU2AOUq_1EPGU,902
msgspec/toml.py,sha256=f0Vte-oW3WK5avMFHf22WuqoccaaVGGKFu98m43wu9Q,5389
msgspec/yaml.py,sha256=LT2T0HW-FtHq_wGBD3sGtpgXspN6N5SmesV1BHrSvPs,5260
from msgspec.
Yeah, and we don't ship 32-bit windows wheels, so that definitely was compiled on your machine. Not surprised there's compatibility bugs. Were you intentionally using a 32 bit python version, or is that just incidental? I'd been viewing 32-bit windows builds as a platform with low enough usage that it wasn't worth supporting (conda-forge
, for example, doesn't ship any win32 builds). If I'm mistaken here we could (with some effort) probably squash these bugs and start building wheels for that platform as needed.
from msgspec.
No, it's not needed. It was an older install that I used for one off scripts. Anything in PROD is x64. Might be worth a warning somewhere? Not sure what's best. Just threw me off and I wouldn't have caught it if I wasn't looking at that specific value in the payload.
I really appreciate this library. It's so fast that I'm refactoring a lot of my APIs to use it as well as proselytizing to my coworkers that are using other parsing libs. So thank you for all your efforts!
from msgspec.
Related Issues (20)
- Support encoding any Enum value type
- Json Encoder: dataclass classes are encoded to empty dict
- Tighten typing of msgspec.json.schema
- Support numeric constraints for Decimal values
- Support decoding empty strings as unset for all field types
- Does msgspec have a concept of schema mode?
- Add an option to disable constraint checks
- Ability to add an example to a Struct as output to the JSON schema
- Unable to encode `lxml.etree._ElementUnicodeResult`
- fallback to dict for unknown type in tagged union? HOT 3
- Multiple types to same Struct HOT 1
- Encode field name
- Encode_into might not write data at the intended offset location if buffer is too small. HOT 4
- 3.13 support HOT 1
- Converting an object / dict to a struct where the struct contains a Raw field fails with "Expected `any`, got ..."
- Incorrect decoding of 65-bit integer
- Is there a way to stop parsing long lists of JSON objects when an object with a certain property value is found
- Allow passing custom globals to use when converting dataclasses
- Positional-only arguments
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgspec.