Various applications that import modules from gi.repository without specifying required versions before fail with the following error:

--snip--
Traceback (most recent call last):
  File "/usr/lib/python3.5/tokenize.py", line 392, in find_cookie
    line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 24: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/redshift-gtk", line 26, in <module>
    from redshift_gtk.statusicon import run
  File "/usr/lib/python3.5/site-packages/redshift_gtk/statusicon.py", line 32, in <module>
    from gi.repository import Gtk, GLib, GObject
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/home/bevan/git/pygobject/dest/usr/lib/python3.5/site-packages/gi/importer.py", line 160, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/home/bevan/git/pygobject/dest/usr/lib/python3.5/site-packages/gi/importer.py", line 123, in _check_require_version
    PyGIWarning, stacklevel=stacklevel)
  File "/usr/lib/python3.5/warnings.py", line 18, in showwarning
    file.write(formatwarning(message, category, filename, lineno, line))
  File "/usr/lib/python3.5/warnings.py", line 26, in formatwarning
    line = linecache.getline(filename, lineno) if line is None else line
  File "/usr/lib/python3.5/linecache.py", line 16, in getline
    lines = getlines(filename, module_globals)
  File "/usr/lib/python3.5/linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "/usr/lib/python3.5/linecache.py", line 136, in updatecache
    with tokenize.open(fullname) as fp:
  File "/usr/lib/python3.5/tokenize.py", line 456, in open
    encoding, lines = detect_encoding(buffer.readline)
  File "/usr/lib/python3.5/tokenize.py", line 433, in detect_encoding
    encoding = find_cookie(first)
  File "/usr/lib/python3.5/tokenize.py", line 397, in find_cookie
    raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for '/usr/bin/sys'
--snip--

A minimal example is the following:
--snip--
#!/usr/bin/env python
from gi.repository import Gtk
--snip--

/usr/bin/sys is a binary provided by openafs which should have no relation to python or gobject whatsoever. The error only occurs if the python script and the "sys" binary lie in the same directory (here: /usr/bin).

I did a git bisect and the result was the following:

--snip--
2048dc8d1d708abce7037f96483c6d776567d6b5 is the first bad commit
commit 2048dc8d1d708abce7037f96483c6d776567d6b5
Author: Christoph Reiter <creiter@src.gnome.org>
Date:   Mon Mar 2 20:58:04 2015 +0100

    Add gi.PyGIWarning and use it instead of PyGIDeprecationWarning in case the version to import wasn't specified.
    
    This makes the warning visible by default.
    See commit ef3bff4e570363e4f383d4cdae9cecd4073b03d8 for more info on the warning.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727379

:040000 040000 3358c42f8fb5e39f8a71870f07cb92f93cb5a826 d8b9a350bbf2cef8f44ef9f799c56a9aa979d3a1 M	gi
:040000 040000 37ed39b29345a56b671bb6658935f7bc01f7ced5 734e76787c7ef9eafcd3dc358b94bcf794d9c0d3 M	tests
--snip--

Specifying the version before import "solves" the problem. Example:
--snip--
#!/usr/bin/python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
--snip--

This and the bisect lead to the assumption that the error lies somewhere in the code generating the warnings.
