Skip to content

Commit

Permalink
Drop support for cdecimal (#20)
Browse files Browse the repository at this point in the history
From https://stackoverflow.com/a/8192918/284318:

> As of Python 3.3, the cdecimal implementation is now the built-in
> implementation of the decimal standard library module, so you don't
> need to install anything. Just use decimal.

Since combining `decimal` and `cdecimal` can result in weird bugs, and
since I will drop Python 2 support in the next release anyways,
supporting `cdecimal` doesn't make sense anymore.
  • Loading branch information
dbrgn committed Feb 10, 2020
1 parent 7f22f98 commit da5c911
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 46 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Expand Up @@ -12,20 +12,16 @@ env:
- TOXENV=py27-django16
- TOXENV=py27-django17
- TOXENV=py27-django18
- TOXENV=py27-django18-cdecimal

- TOXENV=py33-django17
- TOXENV=py33-django18
- TOXENV=py33-django18-cdecimal

- TOXENV=py34-django15
- TOXENV=py34-django16
- TOXENV=py34-django17
- TOXENV=py34-django18
- TOXENV=py34-django18-cdecimal

- TOXENV=py35-django18
- TOXENV=py35-django18-cdecimal

- TOXENV=pypy-django14
- TOXENV=pypy-django15
Expand Down
8 changes: 2 additions & 6 deletions README.rst
Expand Up @@ -25,12 +25,8 @@ Django ticket `#361 <https://code.djangoproject.com/ticket/361>`_ has been
closed as *wontfix*, so I had to create an alternative that is easy to install
in a new Django project.

It currently supports ``int``, ``float``, ``Decimal`` and ``cDecimal`` types, or
any other type that can be converted to int or float.

**WARNING: Note that when you have the ``cdecimal`` package installed, I assume
all ``Decimal`` values that are passed to the tag are of ``cdecimal`` type. If
they aren't, weird things may happen.**
It currently supports ``int``, ``float`` and ``Decimal`` types, or any other
type that can be converted to int or float.


Installation
Expand Down
5 changes: 1 addition & 4 deletions mathfilters/templatetags/mathfilters.py
Expand Up @@ -2,10 +2,7 @@
from __future__ import print_function, division, absolute_import, unicode_literals

import logging
try:
from cdecimal import Decimal
except ImportError:
from decimal import Decimal
from decimal import Decimal

from django.template import Library

Expand Down
5 changes: 1 addition & 4 deletions mathfilters/tests.py
Expand Up @@ -3,10 +3,7 @@

import unittest
import logging
try:
from cdecimal import Decimal
except ImportError:
from decimal import Decimal
from decimal import Decimal

from templatetags import mathfilters

Expand Down
32 changes: 4 additions & 28 deletions tox.ini
Expand Up @@ -2,10 +2,10 @@
[tox]
envlist =
py26-django11, py26-django12, py26-django13, py26-django14, py26-django15, py26-django16,
py27-django14, py27-django15, py27-django16, py27-django17, py27-django18, py27-django18-cdecimal,
py33-django17, py33-django18, py33-django18-cdecimal,
py34-django15, py34-django16, py34-django17, py34-django18, py34-django18-cdecimal,
py35-django18, py35-django18-cdecimal,
py27-django14, py27-django15, py27-django16, py27-django17, py27-django18,
py33-django17, py33-django18,
py34-django15, py34-django16, py34-django17, py34-django18,
py35-django18,
pypy-django14, pypy-django15, pypy-django16, pypy-django17, pypy-django18,
pypy3-django17, pypy3-django18

Expand Down Expand Up @@ -77,12 +77,6 @@ basepython=python2.7
deps=
django<1.9

[testenv:py27-django18-cdecimal]
basepython=python2.7
deps=
django<1.9
http://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz

# Python 3.3

[testenv:py33-django17]
Expand All @@ -95,12 +89,6 @@ basepython=python3.3
deps=
django<1.9

[testenv:py33-django18-cdecimal]
basepython=python3.3
deps=
django<1.9
http://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz

# Python 3.4

[testenv:py34-django15]
Expand All @@ -123,25 +111,13 @@ basepython=python3.4
deps=
django<1.9

[testenv:py34-django18-cdecimal]
basepython=python3.4
deps=
django<1.9
http://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz

# Python 3.5

[testenv:py35-django18]
basepython=python3.5
deps=
django<1.9

[testenv:py35-django18-cdecimal]
basepython=python3.5
deps=
django<1.9
http://www.bytereef.org/software/mpdecimal/releases/cdecimal-2.3.tar.gz

# Pypy

[testenv:pypy-django14]
Expand Down

0 comments on commit da5c911

Please sign in to comment.