This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: decimal module is no longer 2.3 compatible
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: hierro, rhettinger
Priority: normal Keywords:

Created on 2005-06-30 19:19 by hierro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg25697 - (view) Author: Mike Orr (hierro) Date: 2005-06-30 19:19
decimal.py is no longer compatible with Python 2.3.


mso@tux ~/src/Python-2.4.1/Lib $ python
'import site' failed; use -v for traceback
Python 2.3.4 (#1, Nov 30 2004, 10:15:28)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1,
ssp-3.3.2-2, pie-8.7.6)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import decimal
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "decimal.py", line 137, in ?
    import copy
  File "copy.py", line 65, in ?
    import inspect
  File "inspect.py", line 31, in ?
    import sys, os, types, string, re, dis, imp,
tokenize, linecache
  File "os.py", line 133
    from os.path import (curdir, pardir, sep, pathsep,
defpath, extsep, altsep,
                        ^
SyntaxError: invalid syntax


The error is the "()" in the 'from' statement.

The docstring reads:

# This module is currently Py2.3 compatible and should
be kept that way
# unless a major compelling advantage arises.  IOW, 2.3
compatibility is
# strongly preferred, but not guaranteed.

Please remove this paragraph or otherwise correct it. 
Perhaps there should also be a note in Misc/NEWS or
somewhere since the following thread in python-dev
seems to suggest decimal was meant to remain compatible
until 2.5 is released:
http://mail.python.org/pipermail/python-dev/2004-August/048135.html
msg25698 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-06-30 19:38
Logged In: YES 
user_id=80475

Are you mixing tools across multiple Python versions? 

The traceback says the problem is in os.py which was changed
after Py2.3.  The decimal module ought to work fine with
Py2.3's original os.py.  Also, your directory line says
2.4.1.  Further, there is a failed "import site" indicating
that something else is wrong with your build.

Please double check your assertions on a clean 2.3 build. 
If the original report is invalid, please mark it as such
and close the bug.
msg25699 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-06-30 20:07
Logged In: YES 
user_id=80475

Now I see what is going on.  You're running Py2.3 on the 2.4
library.  What you need to do is copy decimal.py into your
Py2.3 library and run it in a different directory or perhaps
alter your sys.path to search the correct 2.3 sources.
msg25700 - (view) Author: Mike Orr (hierro) Date: 2005-06-30 20:23
Logged In: YES 
user_id=239757

It was indeed using the 2.4 'os' module.  Copying decimal.py
to an empty directory and importing that, works.
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42149
2005-06-30 19:19:22hierrocreate