Next: Patched functions
Up: Caveats
Previous: Caveats
Contents
Known bugs
Apart from speed, functions are supposed to run identically under Psyco and under Python, with the following known exceptions:
(in frame objects)
f_back
f_code
f_globals
f_locals
(exception)
KeyboardInterrupt
- The functions locals, eval, execfile, vars, dir and input should work as expected starting from Psyco 1.3, but see section
.
- Frame objects are emulated. The sys._getframe function returns an instance of a custom class which emulates the standard frame objects' behavior as much as possible. The frames corresponding to a Psyco-accelerated frame have some placeholder attributes, notably f_locals. There is no way to read the local variables of a Psyco-accelerated frame. Actually, only the f_code, f_globals, f_back and f_lineno fields are well-tested. Also keep in mind that if you obtain a real frame object (which you can do with some other mean than sys._getframe, e.g. via a traceback object), the f_back chained list will not include the Psyco-accelerated frames.
- The compiled machine code does not include the regular polling done by Python, meaning that a KeyboardInterrupt will not be detected before execution comes back to the regular Python interpreter. Your program cannot be interrupted if caught into an infinite Psyco-compiled loop. (This could be fixed if requested.)
- Infinite recursions are not correctly detected. They are likely to result in segmentation faults (or whatever a stack overflow triggers on your system) instead of Python's nice RuntimeError. Similarily, circularities among data structures can cause troubles (e.g. printing or comparing lists that contain themselves).
- In Python 2.6 parts of the warnings module were rewritten in C. As a result, the reported warnings may be misplaced (they cannot show a Psyco-compiled frame).
- In Python 2.6, creating namedtuple classes (not instances) in a Psyco-optimized function gives the class the wrong __module__ attribute, for the same reason as above: it is created by C code, so it ignores the Psyco frame hooks.
At other points, Psyco makes assumptions that may be wrong (and will cause damage if they turn out to be):
(module)
rexec
- Built-ins are assumed never to change. Global variables can change, of course, but you must not add or remove a global variable to shadow or expose a built-in (at least not after a module is initialized).
- Do not dynamically change the methods of the new-style classes (classes that inherit from a built-in type).
- Psyco assumes that types never change. This is basically wrong (you can assign to __class__). This might cause Psyco to randomly believe that instances are still of their previous type.
- Do not use Psyco together with restricted execution (the rexec module). (Given that rexec is deprecated and not safe in the first place, not using it is probably a good idea anyway.)
Some minor points:
Next: Patched functions
Up: Caveats
Previous: Caveats
Contents
2011-11-26