Skip to content

Commit c603f16

Browse files
Remove Python limitation on large int<->str conversions (next) (#756)
1 parent 864d409 commit c603f16

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].
66

7+
## [Unreleased]
8+
9+
### Fixed
10+
11+
- index: Remove Python limitation on large int<->str conversions.
12+
713
## [7.0.0rc2] - 2023-07-26
814

915
### Fixed

src/dipdup/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ async def cli(ctx: click.Context, config: list[str], env_file: list[str]) -> Non
178178
if '--help' in args or args in (['config'], ['hasura'], ['schema']) or args[0] in ('self', 'report'):
179179
return
180180

181+
# NOTE: https://github.com/python/cpython/issues/95778
182+
sys.set_int_max_str_digits(0)
183+
181184
from dotenv import load_dotenv
182185

183186
from dipdup.exceptions import ConfigurationError

src/dipdup/models/tezos_tzkt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ def from_json(cls, token_transfer_json: dict[str, Any]) -> 'TzktTokenTransferDat
515515
to_json = token_transfer_json.get('to') or {}
516516
standard = token_json.get('standard')
517517
metadata = token_json.get('metadata')
518+
amount = token_transfer_json.get('amount')
519+
amount = int(amount) if amount is not None else None
520+
518521
return TzktTokenTransferData(
519522
id=token_transfer_json['id'],
520523
level=token_transfer_json['level'],
@@ -529,7 +532,7 @@ def from_json(cls, token_transfer_json: dict[str, Any]) -> 'TzktTokenTransferDat
529532
from_address=from_json.get('address'),
530533
to_alias=to_json.get('alias'),
531534
to_address=to_json.get('address'),
532-
amount=token_transfer_json.get('amount'),
535+
amount=amount,
533536
tzkt_transaction_id=token_transfer_json.get('transactionId'),
534537
tzkt_origination_id=token_transfer_json.get('originationId'),
535538
tzkt_migration_id=token_transfer_json.get('migrationId'),

0 commit comments

Comments
 (0)