bug: Incorrect serialization of numeric values
还没有人认领这个 Issue。
评估
调研方向
从 tests/test_codecs/test_numeric 开始,在 test_numeric 的用例中添加 10000 以复现该失败。跟踪负责返回 1E+4 而不是 10000 的数字序列化逻辑,然后运行测试并确认现有用例仍能通过,同时保留预期的小数字符串。
由索引模型根据 Issue 内容生成。
描述
- asyncpg version: 0.29.0
- PostgreSQL version: 13
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: no SaaS, yes reproducable with local postgres - Python version: 3.10
- Platform: linux
- Do you use pgbouncer?: no
- Did you install asyncpg with pip?: yes
- If you built asyncpg locally, which version of Cython did you use?: none
- Can the issue be reproduced under both asyncio and
uvloop?: yes
This happens when query selects a numeric column. Numbers like 10000, 100000, etc. get serialized in scientific notation. For example 10000 becomes 1E+4.
To reproduce the error, you can do the following:
Inside tests/test_codecs/test_numeric if 10000 is added in cases then the test fails, due to incorrect serialization logic.
async def test_numeric(self):
# Test that we handle dscale correctly.
cases = [
'0.001',
'0.001000',
'1',
'1.00000',
'10000', # new test case
]
fail error:
line 614, in test_numeric
self.assertEqual(str(res), case)
AssertionError: '1E+4' != '10000'
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 469
- 平均合并
- 4 天 1 小时
- 30 天内合并 PR
- 14
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/asyncpg 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MagicStack/asyncpg#1357 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 72/100
MagicStack/asyncpg#1342 ·
-
难度 3/5 1-2 天 新手友好度 56/100
MagicStack/asyncpg#1340 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 28/100
MagicStack/asyncpg#1337 ·
-
难度 4/5 3-5 天 新手友好度 42/100
MagicStack/asyncpg#1330 · 1 条评论 ·
查看 MagicStack/asyncpg 的全部 Issue
相似的 Issue
-
area: harness bug status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 80/100
learningequality/kolibri#15351 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·