Using Decimal library results in compilation errors

Open
#705 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, python
Domain
compilers

Research direction

Start with the example.py reproducer and run transcrypt -bn example.py, then inspect the linked output.txt for the compilation errors. Compare the result with the version that omits Decimal; done means the shown Decimal usage compiles to JavaScript without errors.

Written by the indexing model from the issue text.

Description

IS: enhancement PRIO: 3 nice STATE: postponed

I've a need for accurate decimal values in my code, and thus attempted to utilize Python's Decimal module, but compilation fails when I attempt to run Transcrypt on it.

from decimal import Decimal
class Example:
    def __init__(self, value=Decimal('1.00')):
        self.value=value

My command line param is transcrypt -bn example.py

Dropping use of Decimal from this example compiles to JavaScript successfully.

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin

MacOS Catalina (10.15.2)
Macbook Pro 13-inch 2016

output.txt

Dominant language
Python
Stars
2.9k
Forks
218
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TranscryptOrg/Transcrypt

All issues in TranscryptOrg/Transcrypt

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.