Lines Matching defs:file

116    In Python, there should be no file objects referring to

346 /* rexec.py can't stop a user from getting the file() constructor --
347 all they have to do is get *any* file object f, and then do
351 "file() constructor not accessible in restricted mode");
433 "operation on the same file object.");
512 PyFileObject *file = (PyFileObject *)f;
532 fflush(file->f_fp);
534 PyMem_Free(file->f_setbuf);
535 file->f_setbuf = NULL;
537 file->f_setbuf = (char *)PyMem_Realloc(file->f_setbuf,
541 setvbuf(file->f_fp, file->f_setbuf, type, bufsize);
543 setbuf(file->f_fp, file->f_setbuf);
560 PyFileObject *file = (PyFileObject*)f;
577 Py_DECREF(file->f_encoding);
578 file->f_encoding = str;
579 Py_DECREF(file->f_errors);
580 file->f_errors = oerrors;
587 PyErr_SetString(PyExc_ValueError, "I/O operation on closed file");
598 /* Refuse regular file I/O if there's data in the iteration-buffer.
621 PySys_WriteStderr("close failed in file object destructor:\n");
646 ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>",
658 ret = PyString_FromFormat("<%s file %s, mode '%s' at %p>",
688 #error "Large file support, but neither off_t nor fpos_t is large enough."
729 #error "Large file support, but no way to fseek."
735 Return -1 on failure with errno set appropriately, current file
752 #error "Large file support, but no way to ftell."
826 /* Get current file position. If the file happens to be open for
859 * of the current file state.
882 /* Truncate. Note that this may grow the file! */
905 /* Restore original file position. */
1028 /* Add 1 so if the file were to grow we'd notice. */
1306 * the file.
1369 /* \n came from us; last line of file, no newline */
1926 /* The iterator might have closed the file on us. */
1936 apply the same rules as for file.write() and
2029 "readline([size]) -> next line from the file, as a string.\n"
2043 "write(str) -> None. Write string str to file.\n"
2046 "the file on disk reflects the data written.");
2049 "fileno() -> integer \"file descriptor\".\n"
2051 "This is needed for lower-level file interfaces, such os.read().");
2054 "seek(offset[, whence]) -> None. Move to new file position.\n"
2057 "0 (offset from start of file, offset should be >= 0); other values are 1\n"
2059 "relative to end of file, usually negative, although many platforms allow\n"
2060 "seeking beyond the end of a file). If the file is opened in text mode,\n"
2064 "Note that not all file objects are seekable.");
2068 "truncate([size]) -> None. Truncate the file to at most size bytes.\n"
2070 "Size defaults to the current file position, as returned by tell().");
2074 "tell() -> current file position, an integer (may be a long integer).");
2080 "readlines([size]) -> list of strings, each a line from the file.\n"
2093 "writelines(sequence_of_strings) -> None. Write the strings to the file.\n"
2102 "close() -> None or (perhaps) an integer. Close the file.\n"
2104 "Sets data attribute .closed to True. A closed file cannot be used for\n"
2106 "error. Some kinds of file objects (for example, opened by popen())\n"
2110 "isatty() -> true or false. True if the file is connected to a tty device.");
2116 "__exit__(*excinfo) -> None. Closes the file.");
2144 "file mode ('r', 'U', 'w', 'a', possibly with 'b' or '+' added)"},
2146 "file name"},
2148 "file encoding"},
2192 if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0)
2201 if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0)
2218 {"closed", (getter)get_closed, NULL, "True if the file is closed"},
2220 "end-of-line convention used in this file"},
2235 /* Make sure that file has a readahead buffer with at least one byte
2351 not_yet_string = PyString_InternFromString("<uninitialized file>");
2390 /* Have to close the existing file first. */
2398 if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file",
2414 if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:file", kwlist,
2421 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file",
2446 "file(name[, mode[, buffering]]) -> file object\n"
2448 "Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n"
2449 "writing or appending. The file will be created if it doesn't exist\n"
2455 "to open a file is with the builtin open() function.\n"
2458 "Add a 'U' to mode to open the file for input with universal newline\n"
2459 "support. Any line ending in the input file will be seen as a '\\n'\n"
2460 "in Python. Also, a file so opened gains the attribute 'newlines';\n"
2469 "file",
2546 /* Interfaces to write objects/strings to file-like objects */
2553 PyErr_SetString(PyExc_TypeError, "writeobject with NULL file");
2626 "null file for PyFile_WriteString");
2654 /* Try to get a file-descriptor from a Python object. If the object
2657 an integer or long integer, which is returned as the file descriptor value.
2702 "file descriptor cannot be a negative integer (%i)",
2721 ** \n on the next read. Also, if the file is open in binary mode
2762 ** so we're okay if the last char in the file
2789 /* If we have no file object we cannot save the
2811 ** \n on the next read. Also, if the file is open in binary mode