Skip to content

Instantly share code, notes, and snippets.

@trag1c
Created October 13, 2022 04:33
Show Gist options
  • Save trag1c/60c60e4a7a99811b7af6f74e9f282e00 to your computer and use it in GitHub Desktop.
Save trag1c/60c60e4a7a99811b7af6f74e9f282e00 to your computer and use it in GitHub Desktop.
Stuff removed in Python 3.x

Stuff Removed in Python 3.x

Python 3.0

Removed in Python 3.0:

  • tuple parameter unpacking
  • backticks (use repr())
  • <> (use !=)
  • exec as a keyword
  • trailing L in integer literals
  • leading u in string literals
  • support for __members__
  • support for __methods__
  • star imports inside functions
  • __oct__ (use __index__)
  • __hex__ (use __index__)
  • __nonzero__ (use __bool__)
  • apply() (use *args)
  • callable() (was it readded later or what)
  • coerce()
  • execfile() (use exec)
  • file type (use open())
  • reduce() (use functools.reduce)
  • reload() (use imp.reload())
  • dict.has_key() (use in operator)
  • relative imports not starting with .
  • python 2 classes
  • sys.maxint (use sys.maxsize)
  • sys.exitfunc()
  • sys.exc_clear()
  • sys.exc_type
  • sys.exc_value
  • sys.exc_traceback
  • array.array.read()
  • array.array.write()
  • operator.sequenceIncludes()
  • operator.isCallable()
  • thread.acquire_lock()
  • thread.release()
  • random.jumpahead()
  • basestring (use str)
  • sets (use set)
  • os.tmpnam() (use tempfile module)
  • os.tempnam() (use tempfile module)
  • os.tmpfile() (use tempfile module)
  • unbound methods
  • string.letters (use string.ascii_letters)
  • string.lowercase (use string.ascii_lowercase)
  • string.uppercase (use string.ascii_uppercase)
  • StandardError

C API

  • PyNumber_Coerce()
  • PyNumber_CoerceEx()
  • PyMember_Get()
  • PyMember_Set()
  • METH_OLDARGS
  • WITH_CYCLE_GC

Modules

  • gopherlib
  • md5
  • cfmfile
  • cl
  • mimetools
  • MimeWriter
  • mimify
  • multifile
  • posixfile
  • rfc822
  • sha
  • sv
  • timing
  • al
  • IRIX related:
    • AL/al
    • cd/CD
    • cddb
    • cdplayer
    • cl/CL/CL_old
    • DEVICE/GL/gl/cgen/cgensuport
    • ERRNO
    • FILE
    • FL/fl/flp
    • fm
    • GET
    • GLWS
    • imgfile
    • IN
    • IOCTL
    • jpeg
    • panel
    • panelparser
    • readcd
    • SV
    • torgb
    • WAIT
  • Mac related:
    • _builtinSuites
    • Audio_mac
    • aepack
    • aetools
    • aetypes
    • applesingle
    • appletrawmain
    • appletrunner
    • argvemulator
    • autoGIL
    • bgenlocations
    • bundlebuilder
    • Carbon
    • CodeWarrior
    • ColorPicker
    • EasyDialogs
    • Explorer
    • Finder
    • findertools
    • FrameWork
    • gensuitemodule
    • ic
    • icglue
    • icopen
    • macerrors
    • MacOS
    • macostools
    • macresource
    • MiniAEFrame
    • Nav
    • Netscape
    • OSATerminology
    • pimp
    • PixMapWrapper
    • StdSuites
    • SystemEvents
    • Terminal
    • terminalcommand
    • videoreader
    • W
  • Solaris related:
    • SUNAUDIODEV/sunaudiodev
  • audiodev
  • imputil
  • mutex
  • stringold
  • sunaudio
  • toaiff
  • user
  • new
  • pure
  • test.testall
  • Bastion/rexec
  • bsddb185
  • Canvas
  • commands
  • compiler
  • dircache
  • dl
  • fpformat
  • htmllib
  • ihooks
  • imageop
  • linuxaudiodev
  • mhlib
  • popen2
  • sgmllib
  • sre
  • stat
  • statvfs
  • thread
  • urllib
  • UserDict
  • UserList/UserString
  • bsddb3

Python 3.2

  • HTTP 0.9 support in urllib.request and http.client
  • configparser.ConfigParser
  • sys.setfilesystemencoding() ("because it had a flawed design")
  • string.maketrans()
  • contextlib.nested()

C API

  • PyEval_CallObject for function declaration
  • --with-wctype-functions option
  • O? format from PyArg_Parse functions
  • PyCObject type
  • PyArg_Parse*() functions:
    • t# format (use s# or s*)
    • w and w# formats (use w*)

Python 3.3

  • -Q command-line flag
  • --with-wide-unicode ./configure flag
  • pydoc.serve()
  • Tk GUI for pydoc
  • OSF support
  • strict argument to email.parser.Parser
  • unittest.TestCase.assertSameElements
  • decimal.Context._clamp
  • smtplib.SSLFakeFile
  • ast.__version__

C API

  • Py_buffer.smalltable

Python 3.4

  • pdb.print()
  • OS/2 support
  • Windows 2000 support
  • support for Windows systems where COMSPEC points to command.com
  • VMS support
  • SO makefile macro
  • unmaintained Misc/TextMate and Misc/vim directories
  • importlib.PyLoader
  • importlib.PyPycLoader
  • strict argument for http.client.HTTPConnection and http.client.HTTPSConnection
  • urllib.request.Request methods:
    • add_data
    • has_data
    • get_data
    • get_type
    • get_host
    • get_selector
    • set_proxy
    • get_origin_req_host
    • is_unverifiable
  • marshal.TYPE_INT64
  • difflib.SequenceMatcher.isbjunk()
  • difflib.SequenceMatcher.isbpopular()
  • pydoc.Scanner
  • _gestalt module
  • platform._mac_ver_lookup
  • platform._mac_ver_gstalt
  • platform._bcd2str
  • hardcodd copies of certain stat constants that were included in the tarfile module

C API

  • PyThreadState.tick_counter
  • PyFrameObject.f_tstate

Python 3.5

  • asyncio.JoinableQueue
  • email.__version__
  • ftplib.Netrc
  • the concept of .pyo files
  • datetime.time is no longer falsy at UTC midnight
  • strict mode and argument of html.parser.HTMLParser, HTMLParser.error() and HTMLParserError
  • make touch build target

C API

  • PyMemoryViewObject.format
  • PyObject_REPR macro

Python 3.6

  • default_format attribute for distutils.command.sdist.sdist
  • 3DES from the default cipher suites in the ssl module
  • inspect.getmoduleinfo()
  • traceback module:
    • Ignore
    • usage
    • modname
    • fullmodname
    • find_lines_from_code
    • find_lines
    • find_strings
    • find_executable_lines
  • tkinter.tk_menuBar()
  • tkinter.tk_bindForTraversal()
  • asynchat.fifo
  • function call opcodes:
    • CALL_FUNCTION_VAR
    • CALL_FUNCTION_VAR_KW
    • MAKE_CLOSURE

C API

  • PyExc_RecursionErrorInst

Modules

  • IN
  • CDROM
  • DLFCN
  • TYPES
  • CDIO
  • STROPTS

Python 3.7

  • support for building --without-threads
  • os.stat_float_times()
  • exclude argument in tarfile.TarFile.add()
  • ntpath.splitunc()
  • plistlib.Plist
  • plistlib.Dict
  • plistlib._InternalDict
  • asyncio.windows_utils.socketpair()
  • distutils.install_misc
  • fpetcl module
  • STORE_ANNOTATION opcode
  • CALL_PROFILE build option

Python 3.8

  • BREAK_LOOP opcode
  • CONTINUE_LOOP opcode
  • SETUP_LOOP opcode
  • SETUP_EXCEPT opcode
  • importing ABCs from collections (import from collections.abc instead)
  • the macpath module
  • platform.popen()
  • time.clock()
  • pyvenv script (in favor of python -m venv)
  • cgi.parse_qs
  • cgi.parse_qsl
  • cgi.escape
  • tarfile.filemode
  • xml.etree.ElementTree.XMLParser.doctype()
  • "unicode_internal" codec
  • bufsize kwarg for fileinput.input() and fileinput.FileInput()
  • sys.set_coroutine_wrapper()
  • sys.get_coroutine_wrapper()
  • __str__ implementations for bool, int, complex, float (and a few classes from the stdlib); they now inherit it from object and base it on the __repr__ method
  • header files and functions related to pgen

C API

  • one Py_ssize_t member from PyGC_Head (reducing the size of GC tracked objects (like tuples, lists, or dicts) 4 or 8 bytes)
  • m flag for pymalloc
  • PyByteArray_Init()
  • PyByteArray_Fini()
  • duality of Modules/Setup and Modules/Setup.dist
  • PyEval_ReInitThreads()

Python 3.9

  • daemon threads from concurrent.futures.ThreadPoolExecutor and concurrent.futures.ProcessPoolExecutor
  • unittest.mock.__version__
  • nntplib.NNTP.xpath()
  • nntplib.NNTP.xgtitle()
  • array.array.tostring()
  • array.array.fromstring()
  • sys.callstats()
  • sys.getcheckinterval()
  • sys.setcheckinterval()
  • _dummy_thread module
  • _dummy_threading module
  • aifc.openfp() alias to aifc.open()
  • sunau.openfp() alias to sunau.open()
  • wave.openfp() alias to wave.open()
  • threading.Thread.isAlive() (use is_alive())
  • xml.etree.ElementTree.getchildren()
  • xml.etree.ElementTree.getiterator()
  • old plistlib API
  • base64.encodestring() alias (use base64.encodebytes())
  • base64.decodestring() alias (use base64.decodebytes())
  • fractions.gcd() (use math.gcd())
  • buffering parameter of bz2.BZ2File
  • encoding parameter of json.loads()
  • sys.getcounts()
  • -X showalloccount
  • NamedTuple._field_types
  • symtable.SymbolTable.has_exec()
  • asyncio.Task.current_task()
  • asyncio.Task.all_tasks()
  • html.parser.HTMLParser.unescape()
  • COUNT_ALLOCS build macro

C API

  • PyImport_Cleanup()
  • PyGen_NeedsFinalizing()
  • PyConfig.show_alloc_count
  • PyIndex_Check() macro
  • PyFPE_START_PROTECT() macro of pyfpe.h
  • PyFPE_END_PROTECT() macro of pyfpe.h
  • PyTypeObject.tp_print
  • _PyRuntime.getframe hook
  • _PyThreadState_GetFrame macro
  • PyThreadFrameGetter type
  • PyAsyncGen_ClearFreeLists()
  • PyContext_ClearFreeList()
  • PyDict_ClearFreeList()
  • PyFloat_ClearFreeList()
  • PyFrame_ClearFreeList()
  • PyList_ClearFreeList()
  • PyMethod_ClearFreeList()
  • PyCFunction_ClearFreeList()
  • PySet_ClearFreeList()
  • PyTuple_ClearFreeList()
  • PyUnicode_ClearFreeList()
  • _PyUnicode_ClearStaticStrings()
  • Py_UNICODE_MATCH
  • _PyBytes_InsertThousandsGroupingLocale
  • _PyBytes_InsertThousandsGrouping
  • _Py_InitializeFromArgs
  • _Py_InitializeFromWideArgs
  • _PyFloat_Repr
  • _PyFloat_Digits
  • _PyFloat_DigitsInit
  • PyFrame_ExtendStack
  • _PyAIterWrapper_Type
  • PyNullImporter_Type
  • PyCmpWrapper_Type
  • PySortWrapper_Type
  • PyNoArgsFunction

Python 3.10

  • distutils.bdist_wininst
  • complex.__int__
  • complex.__float__
  • complex.__floordiv__
  • complex.__mod__
  • complex.__divmod__
  • complex.__rfloordiv__
  • complex.__rmod__
  • complex.__rdivmod__
  • _markupbase.ParserBase.error()
  • unicodedata.ucnhash_CAPI
  • parser module
  • formatter module
  • collections.abc aliases from collections
  • loop parameter from most of asyncio's API

C API

  • PyParser_SimpleParseStringFlags
  • PyParser_SimpleParseStringFlagsFilename
  • PyParser_SimpleParseFileFlags
  • PyNode_Compile
  • PyModule_GetWarningsModule()
  • struct _node
  • Py_FrozenMain
  • Py_UNICODE_str* manipulating Py_UNICODE* strings
  • PyUnicode_GetMax()
  • PyLong_FromUnicode()
  • PyUnicode_AsUnicodeCopy()
  • _Py_CheckRecursionLimit
  • Py_ALLOW_RECURSION macro
  • Py_END_ALLOW_RECURSION macro
  • PyInterpreterState.recursion_critical
  • PyOS_InitInterrupts()
  • PyAST_Validate()
  • symtable.h header file and the undocumented functions:
    • PyST_GetScope()
    • PySymtable_Build()
    • PySymtable_BuildObject()
    • PySymtable_Free
    • Py_SymtableString()
    • Py_SymtableStringObject()
  • PyOS_ReadlineFunctionPointer()
  • compiler and parser functions using struct _mod type:
    • PyAST_Compile()
    • PyAST_CompileEx()
    • PyAST_CompileObject()
    • PyFuture_FromAST()
    • PyFuture_FromASTObject()
    • PyParser_ASTFromFile()
    • PyParser_ASTFromFileObject()
    • PyParser_ASTFromFilename()
    • PyParser_ASTFromString()
    • PyParser_ASTFromStringObject()
  • pyarena.h header file with functions:
    • PyArena_New()
    • PyArena_Free()
    • PyArena_Malloc()
    • PyArena_AddPyObject()
  • PyThreadState.use_tracing

Python 3.11

  • exc_type and exc_traceback from exceptions
  • COPY_DICT_WITHOUT_KEYS
  • GEN_START
  • smtpd.MailmanProxy
  • binhex module
  • binascii.a2b_hqx()
  • binascii.b2a_hqx()
  • binascii.rlecode_hqx()
  • binascii.rledecode_hqx()
  • distutils.bdist_msi
  • reuse_address parameter of asyncio.loop.create_datagram.endpoint() ("due to significant security concerns")
  • __getitem__ from xml.dom.pulldom.DOMEventStream, wsgiref.util.FileWrapper, and fileinput.FileInput
  • gettext functions:
    • lgettext
    • ldgettext
    • lngettext
    • ldngettext
    • bind_textdomain_codeset
    • output_charset()
    • set_output_charset()
    • codeset parameter of translation()
    • codeset parameter of install()
  • @asyncio.coroutine
  • asyncio.coroutine.CoroWrapper
  • _tkinter.TkappType.split()
  • inspect.getargspec()
  • inspect.formatargspec()
  • inspect.Signature.from_builtin
  • inspect.Signature.from_function
  • namespace package support from unittest directory
  • __class_getitem__ method from pathlib.PurePath
  • float.__set_format__()
  • --experimental-isolated-subinterpreters configure flag
  • Pynche (The Pythonically Natural Color and Hue Editor) from Tools/scripts
  • --with-tcltk-includes
  • --with-tcltk-libs

C API

  • Py_UNICODE encoder APIs
  • PyFrameObject structure fields:
    • f_back
    • f_blockstack
    • f_builtins
    • f_code
    • f_gen
    • f_globals
    • f_iblock
    • f_lasti
    • f_lineno
    • f_locals
    • f_stackdepth
    • f_state
    • f_trace
    • f_trace_lines
    • f_trace_opcodes
    • f_localsplus
    • f_valuestack
  • PyThreadState struct members:
    • frame
    • tracing
    • recursion_depth
    • stackcheck_counter
  • PyFrame_BlockSetup()
  • PyFrame_BlockPop()
  • math macros using the errno variable:
    • Py_ADJUST_ERANGE1()
    • Py_ADJUST_ERANGE2()
    • Py_OVERFLOWED()
    • Py_SET_ERANGE_IF_OVERFLOW()
    • Py_SET_ERRNO_ON_MATH_ERROR()
  • Py_UNICODE_COPY() macro
  • Py_UNICODE_FILL() macro
  • pystrhex.h header file
  • Py_FORCE_DOUBLE() macro
  • PyHeapType_GET_MEMBERS() macro
  • HAVE_PY_SET_53BIT_PRECISION macro

Python 3.12

  • wstr and wstr_length members from Unicode objects (reduces object size by 8 or 16 bytes)
  • LOAD_METHOD instruction
  • unittest:
    • TestCase aliases:
      • failUnless
      • failIf
      • failUnlessEqual
      • failIfEqual
      • failUnlessAlmostEqual
      • failIfAlmostEqual
      • failUnlessRaises
      • assert_
      • assertEquals
      • assertNotEquals
      • assertAlmostEquals
      • assertNotAlmostEquals
      • assertRegexpMatches
      • assertRaisesRegexp
      • assertNotRegexpMatches
    • TestCase.assertDictContainsSubset
    • use_load_tests parameter in TestLoader.loadTestsFromModule
    • _TextTestResult alias
  • filename attribute/argument for configparser.ParsingError
  • configparser.SafeConfigParser
  • configparser.ConfigParser.readfp()
  • sqlite3.enable_shared_cache()
  • sqlite3.OptimizedUnicode
  • smtpd module
  • io.OpenWrapper
  • _pyio.OpenWrapper
  • ssl.RAND_pseudo_bytes()
  • filename attribute of gzip.GzipFile
  • ssl.match_hostname()
  • locale.format()
  • hashlib.pbkdf2_hmac()
  • xml.etree.ElementTree.Element.copy()
  • zipimport.find_loader()
  • zipimport.find_module()
  • ssl.wrap_socket()
  • importlib.util.set_package
  • suspicious rule from doc Makefile
  • Doc/tools/rstlint.py (in favor of sphinx-lint)
  • non-integral value support for randrange()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment