tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Cleanup Python 2 compatibility wrappers #231

Closed DifferentialOrange closed 1 year ago

DifferentialOrange commented 2 years ago

code-health: remove built-in types wrappers

The built-in basestring abstract type was removed in Python 3 [1]. str must be used for strings and bytes for byte objects. long type was unified with int in Python 3 [2].

  1. https://docs.python.org/3/whatsnew/3.0.html?highlight=basestring
  2. https://peps.python.org/pep-0237/

Part of #212

code-health: remove utf-8 encoding instruction

Since Python 3 the default encoding of source files is already UTF-8 [1]. Unless instruction says something other than some variation of "utf-8", it has no effect [2].

  1. https://docs.python.org/3/howto/unicode.html#the-string-type
  2. https://stackoverflow.com/questions/4872007/where-does-this-come-from-coding-utf-8

Part of #212

code-health: remove print compatibility wrapper

future .print_function brings Python 3 print to Python 2 [1].

  1. https://docs.python.org/2/reference/simple_stmts.html#future

code-health: remove StandardError

StandardError was removed in Python 3 [1]. PEP 249 footnote 10 [2] declares that database modules targeting Python 3 should use Exception as base class instead.

  1. https://docs.python.org/3/whatsnew/3.0.html?highlight=standarderror
  2. https://peps.python.org/pep-0249/#footnotes

Part of #212

code-health: remove collections wrappers

collections.abc was introduced in Python 3.3 [1].

  1. https://docs.python.org/3/library/collections.abc.html

Part of #212

code-health: remove c_ssize_t type wrapper

ctypes.c_ssize_t was introduced in Python 2.7 [1] and Python 3.2 [2].

  1. https://docs.python.org/2.7/library/ctypes.html#ctypes.c_ssize_t
  2. https://docs.python.org/3.2/library/ctypes.html#ctypes.c_ssize_t

Part of #212

code-health: remove string encoding compatibility

See PR [1].

  1. https://github.com/tarantool/tarantool-python/pull/211

Closes #212