Remove obsolete 'future import' statements

Description

The from __future__ import statements were used for python 2.7 compatibility and no longer has any effect.

Environment

None

Pull Requests

https://github.com/datastax/python-driver/pull/1156

Activity

Show:

Brad Schoening 
November 1, 2024 at 3:31 PM

with we should be able to remove the future import statements now.

Brad Schoening 
August 7, 2024 at 3:55 PM

I came across this cpython issue #1720 (snippets below) which looks similar to the problem we saw. What version of cpython are we using? It seems to be fixed in cython 3.x which uses python3 by default:

pitrou commented on May 29, 2017

Ok, @ncoghlan and I managed to diagnose the issue: Cython emulates Python 2-style implicit relative imports on Python 3 (see ). To disable the Python 3.6 warning, one has to add from __future__ import absolute_import at the top of every Cython source file.

…..
pitrou commented on Jun 26, 2017
Well, it's a bit surprising to have to add a __future__ import for a functionality that's actually standard in the Python version you're using ;-)

….
scoder commented on Jun 26, 2017
Cython code uses Python 2 syntax and semantics by default, but you can switch to Python 3 syntax/semantics with a compiler option.

Brad Schoening 
November 6, 2023 at 9:46 PM

I thinking changing the import might clarify the namespace lookup.

from:

import io

to:

from io import BytesIO

Bret McGuire 
November 6, 2023 at 9:25 PM

BytesIOReader is still used quite heavily in the Cython code. I don’t think it’s used directly in any of the Python code with the possible exception of a test case or two.

Brad Schoening 
November 6, 2023 at 9:08 PM

would you know if bytesio.pyd and bytesio.pyx are still used? I don’t see any references in the python (.py) code.

Details

Assignee

Reporter

Labels

Size

Priority

Created May 9, 2023 at 1:23 AM
Updated November 1, 2024 at 3:31 PM