Skip to content

EncodeDecimal must return a serializable type#55

Closed
dpedu wants to merge 1 commit into
jgarzik:masterfrom
dpedu:master
Closed

EncodeDecimal must return a serializable type#55
dpedu wants to merge 1 commit into
jgarzik:masterfrom
dpedu:master

Conversation

@dpedu

@dpedu dpedu commented Nov 2, 2015

Copy link
Copy Markdown

Fixes #54.

Python 2.x's round() automatically converts Decimal types to a float. Python 3's round() returns a rounded Decimal object, leading to infinite recursion as EncodeDecimal is again called (it was passed to json.dumps as default) to convert the Decimal into a serializable type. Explicitly converting to a float will work for both python versions.

@FellowTraveler

Copy link
Copy Markdown

Can definitely confirm.

@reiven

reiven commented Nov 11, 2015

Copy link
Copy Markdown

+1

@alecalve

Copy link
Copy Markdown
Contributor

Duplicate of the now merged #39

@jgarzik jgarzik closed this Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants