@@ -189,30 +189,7 @@ type objects) *must* have the :attr:`ob_size` field.
189189
190190.. c :member :: printfunc PyTypeObject.tp_print
191191
192- An optional pointer to the instance print function.
193-
194- The print function is only called when the instance is printed to a *real * file;
195- when it is printed to a pseudo-file (like a :class: `io.StringIO ` instance), the
196- instance's :c:member: `~PyTypeObject.tp_repr ` or :c:member: `~PyTypeObject.tp_str ` function is called to convert it to
197- a string. These are also called when the type's :c:member: `~PyTypeObject.tp_print ` field is
198- *NULL *. A type should never implement :c:member: `~PyTypeObject.tp_print ` in a way that produces
199- different output than :c:member: `~PyTypeObject.tp_repr ` or :c:member: `~PyTypeObject.tp_str ` would.
200-
201- The print function is called with the same signature as :c:func: `PyObject_Print `:
202- ``int tp_print(PyObject *self, FILE *file, int flags) ``. The *self * argument is
203- the instance to be printed. The *file * argument is the stdio file to which it
204- is to be printed. The *flags * argument is composed of flag bits. The only flag
205- bit currently defined is :const: `Py_PRINT_RAW `. When the :const: `Py_PRINT_RAW `
206- flag bit is set, the instance should be printed the same way as :c:member: `~PyTypeObject.tp_str `
207- would format it; when the :const: `Py_PRINT_RAW ` flag bit is clear, the instance
208- should be printed the same way as :c:member: `~PyTypeObject.tp_repr ` would format it. It should
209- return ``-1 `` and set an exception condition when an error occurs.
210-
211- It is possible that the :c:member: `~PyTypeObject.tp_print ` field will be deprecated. In any case,
212- it is recommended not to define :c:member: `~PyTypeObject.tp_print `, but instead to rely on
213- :c:member: `~PyTypeObject.tp_repr ` and :c:member: `~PyTypeObject.tp_str ` for printing.
214-
215- This field is inherited by subtypes.
192+ Reserved slot, formerly used for print formatting in Python 2.x.
216193
217194
218195.. c :member :: getattrfunc PyTypeObject.tp_getattr
0 commit comments