Python 3.2a1 in rawhide

David Malcolm dmalcolm at redhat.com
Sat Aug 21 22:48:31 UTC 2010


I just built Python 3.2a1 into rawhide:
  http://koji.fedoraproject.org/koji/buildinfo?buildID=191382
so the meaning of "python3" in rawhide just jumped from Python 3.1 to
Python 3.2

A new opcode (SETUP_WITH [1]) was added, to speed up the "with"
statement, and this changes the bytecode format for python 3.  python3's
provides changes from:
  python(abi) = 3.1
  libpython3.1.so.1.0()
to
  python(abi) = 3.2
  libpython3.2.so.1.0()

So once that package hits the buildroot for rawhide, everything that
builds a python3 package or subpackage will need to be rebuilt, to use
the new bytecode format.

Thankfully this will be a much smaller-scale rebuild than the recent 2.7
rebuilds.

To liven things up a bit, the layout of how Python stores cached
bytecode has changed somewhat.

The full details can be seen at:
  http://www.python.org/dev/peps/pep-3147/

but to summarize, where before you had:
   foo/__init__.py
   foo/bar.py
   foo/baz.py
with cached bytecode:
   foo/__init__.pyc
   foo/__init__.pyo
   foo/bar.pyc
   foo/baz.pyo
   foo/bar.pyc
   foo/baz.pyo
with Python 3.2 onwards you now have a __pycache__ directory:
   foo/__init__.py
   foo/bar.py
   foo/baz.py
   foo/__pycache__/
   foo/__pycache__/__init__.cpython-32.pyc
   foo/__pycache__/__init__.cpython-32.pyo
   foo/__pycache__/foo.cpython-32.pyc
   foo/__pycache__/foo.cpython-32.pyo
   foo/__pycache__/bar.cpython-32.pyc
   foo/__pycache__/bar.cpython-32.pyo

and the files are explicitly for "CPython 3.2" (the "32" above refers to
the python version, not the architecture; this threw me initially).

The idea is to permit sharing of modules between multiple
parallel-installable versions of Python.

So you'll need to update the %files for python3 subpackages, listing
something like:
  foo/__pycache__
to capture the directory and the bytecode files within.

Hope this makes sense
Dave

[1] http://svn.python.org/view?view=rev&revision=73597



More information about the devel mailing list