diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a1ad9c89e..0b7ddcd62 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -19,13 +19,8 @@ that might not be of interest or that has already been addressed. Supported Interpreters ---------------------- -PyMongo supports CPython 2.4 and newer, PyPy, and Jython. Language -features not supported by all interpreters can not be used (e.g. -the `with statement -`_ -is not supported in Python 2.4). Please also ensure that your code is -properly converted by `2to3 `_ for -Python 3 support. +PyMongo supports CPython 2.6, 2.7, 3.2 and newer, and PyPy. Language +features not supported by all interpreters can not be used. Style Guide ----------- diff --git a/bson/__init__.py b/bson/__init__.py index 01034183d..3bfc87b0f 100644 --- a/bson/__init__.py +++ b/bson/__init__.py @@ -278,9 +278,8 @@ def _get_timestamp( def _get_long(data, position, as_class, tz_aware, uuid_subtype, compile_re): - # Have to cast to long; on 32-bit unpack may return an int. - # 2to3 will change long to int. That's fine since long doesn't - # exist in python3. + # Have to cast to long (for python 2.x); on 32-bit unpack may return + # an int. value = long(struct.unpack(" MAX_INT32 or value < MIN_INT32: return BSONLON + name + struct.pack(" MAX_INT64 or value < MIN_INT64: raise OverflowError("BSON can only handle up to 8-byte ints") diff --git a/doc/python3.rst b/doc/python3.rst index 13fd935dc..ffd56decc 100644 --- a/doc/python3.rst +++ b/doc/python3.rst @@ -134,39 +134,3 @@ version older than 3.2.3:: ObjectId('5b37392c203135302c203234362c2034352c203235312c203136352c2033342c203532...') -Why do I get a syntax error importing pymongo after installing from source? ---------------------------------------------------------------------------- - -PyMongo makes use of the 2to3 tool to translate much of its code to valid -Python 3 syntax at install time. The translated modules are written to the -build subdirectory before being installed, leaving the original source files -intact. If you start the python interactive shell from the top level source -directory after running ``python setup.py install`` the untranslated modules -will be the first thing in your path. Importing pymongo will result in an -exception similar to:: - - Python 3.2.5 (default, Feb 26 2014, 12:40:25) - [GCC 4.7.3] on linux2 - Type "help", "copyright", "credits" or "license" for more information. - >>> import pymongo - Traceback (most recent call last): - File "", line 1, in - File "pymongo/__init__.py", line 77, in - version = get_version_string() - File "pymongo/__init__.py", line 73, in get_version_string - if isinstance(version_tuple[-1], basestring): - NameError: global name 'basestring' is not defined - -Note the path in the traceback (``pymongo/__init__.py``). Changing out of the -source directory takes the untranslated modules out of your path:: - - $ cd .. - $ python - Python 3.2.5 (default, Feb 26 2014, 12:40:25) - [GCC 4.7.3] on linux2 - Type "help", "copyright", "credits" or "license" for more information. - >>> import pymongo - >>> pymongo.__file__ - '/home/behackett/py3k/lib/python3.2/site-packages/pymongo-2.7-py3.2-linux-x86_64.egg/pymongo/__init__.py' - - diff --git a/pymongo/collection.py b/pymongo/collection.py index 8f11db880..4f1fa047a 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -1022,7 +1022,7 @@ class Collection(common.BaseObject): warnings.warn("ttl is deprecated. Please use cache_for instead.", DeprecationWarning, stacklevel=2) - # The types supported by datetime.timedelta. 2to3 removes long. + # The types supported by datetime.timedelta. if not (isinstance(cache_for, integer_types) or isinstance(cache_for, float)): raise TypeError("cache_for must be an integer or float.") diff --git a/test/test_gridfs.py b/test/test_gridfs.py index 893b73213..2c6a80912 100644 --- a/test/test_gridfs.py +++ b/test/test_gridfs.py @@ -384,7 +384,6 @@ class TestGridfs(unittest.TestCase): self.assertEqual(3, self.fs.find({"filename":"two"}).count()) self.assertEqual(4, self.fs.find().count()) cursor = self.fs.find(timeout=False).sort("uploadDate", -1).skip(1).limit(2) - # 2to3 hint... gout = next(cursor) self.assertEqual(b"test1", gout.read()) cursor.rewind()