Skip to main content

What’s New in Python, Issue 1

Tags

What’s new in Python is a news feed of articles, trends, and stories hand picked by me on what is happening in the Python open source ecosystem.  All of the topics in this article have been hand picked from sources such as Github, Bugs.Python.org, Twitter, and of course, python.org. This latest issue focuses on adding IPv6 support while testing http.server, C API Changes, fork() as a bug on macOS Mojave, voting for the new Python governance model, and Platform.popen() being dropped on older Windows platforms.

 

Adds IPv6 support when invoking http.server directly.

This pull request in CPython adds support for the AF_INET6 (IPv6) address family while using the --bind argument to connect directly to http.server from the command line.  These functionality is now easily testable from this enhancement.

$ python -m http.server 8000 --bind ::1
  1. https://github.com/python/cpython/pull/10595
  2. https://bugs.python.org/issue24209

 

C API Changes

Recently in the Python Developers mailing list discussions has been taking place on some possible changes to the C API running under the hood of projects like CPython and PyPy.  Nothing concrete has been reached yet or to decided upon, but there have been some really interesting ideas being considered around how memory is managed in this API.  For example, one interesting idea was to move to more of a reference counting methodology with strong pointers to objects in memory. Another interesting example was to normalize the ABI for module developers when extending the language, so the same code could be written across multiple different versions of Python.  Not sure what will come of this, but I am interested to see if this gets any traction and how this may impact the object lifecycle in Python itself while developing applications.

(To sign up to the mailing list) https://mail.python.org/mailman/listinfo/python-dev

 

fork() is broken on macOS

It was reported on Twitter by Yury Selivanov and Barry Warsaw that the usage of fork() is now broken on macOS Mojave.  In the tweet thread Armin Ronacher reports that this has been a problem for awhile and not just on Mojave and is due to how Python incorrectly forks a child process while interacting with the SystemConfiguration framework in macOS.  Running Python 3.6 below with the following code on macOS Mojave I did not experience this issue.  However the macOS crash log does show Python 3.7 in the screen shot.

import os
 
try:
	fork_pid = os.fork()
except OSError as err:
	print("Error: {0}".format(err))
	exit("Exiting")
 
if fork_pid == 0:
	print("No PID in the child process")
	exit("Exiting")
else:
	print("Successfully forked the child process {}".format(fork_pid))
	complete = os.waitpid(0,0)
	print(complete)
  1. https://twitter.com/1st1/status/1067904580023926784
  2. https://github.com/python/cpython/blob/4859ba0d2ce4506fddc3f55f90f8dce031b3804f/Modules/_scproxy.c

 

Voting has started for CPython's new governance model

After Guido announced his retirement back in July the Python community needed to decide how their governance model would run going forward.  In August of this year, PEP 8001 was created for Core Members of CPython to vote on how this governance model would proceed in the future.  On December 1st, voting for this process officially opened.  Check out PEP 8001 below.

https://www.python.org/dev/peps/pep-8001/

 

platform.popen() has been deprecated in Python 3.3 and removed in Python 3.8

Platform.popen() has been dropped in favor of the usage of os.popen() instead.  This will provide a much more consistent API usage due to Python 3.5 officially dropping support for Windows XP and Python 2.7 dropping support for Windows 98.

  1. https://github.com/python/cpython/commit/73104fa1e6a791f7d66c0091ed91f6c396ca0fb2
  2. https://bugs.python.org/issue35345

Member for

3 years 9 months
Matt Eaton

Long time mobile team lead with a love for network engineering, security, IoT, oss, writing, wireless, and mobile.  Avid runner and determined health nut living in the greater Chicagoland area.