mirror of
				https://github.com/python/cpython.git
				synced 2025-10-25 02:43:41 +00:00 
			
		
		
		
	 91106cd9ff
			
		
	
	
		91106cd9ff
		
			
		
	
	
	
	
		
			
			* Add -X utf8 command line option, PYTHONUTF8 environment variable and a new sys.flags.utf8_mode flag. * If the LC_CTYPE locale is "C" at startup: enable automatically the UTF-8 mode. * Add _winapi.GetACP(). encodings._alias_mbcs() now calls _winapi.GetACP() to get the ANSI code page * locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8 mode. As a side effect, open() now uses the UTF-8 encoding by default in this mode. * Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding in the UTF-8 Mode. * Update subprocess._args_from_interpreter_flags() to handle -X utf8 * Skip some tests relying on the current locale if the UTF-8 mode is enabled. * Add test_utf8mode.py. * _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to return also the length (number of wide characters). * pymain_get_global_config() and pymain_set_global_config() now always copy flag values, rather than only copying if the new value is greater than the old value.
		
			
				
	
	
		
			55 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* File object interface (what's left of it -- see io.py) */
 | |
| 
 | |
| #ifndef Py_FILEOBJECT_H
 | |
| #define Py_FILEOBJECT_H
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| #define PY_STDIOTEXTMODE "b"
 | |
| 
 | |
| PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
 | |
|                                      const char *, const char *,
 | |
|                                      const char *, int);
 | |
| PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
 | |
| PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
 | |
| PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
 | |
| PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
 | |
| #ifndef Py_LIMITED_API
 | |
| PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
 | |
| #endif
 | |
| 
 | |
| /* The default encoding used by the platform file system APIs
 | |
|    If non-NULL, this is different than the default encoding for strings
 | |
| */
 | |
| PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
 | |
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
 | |
| PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
 | |
| #endif
 | |
| PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
 | |
| 
 | |
| #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
 | |
| PyAPI_DATA(int) Py_UTF8Mode;
 | |
| #endif
 | |
| 
 | |
| /* Internal API
 | |
| 
 | |
|    The std printer acts as a preliminary sys.stderr until the new io
 | |
|    infrastructure is in place. */
 | |
| #ifndef Py_LIMITED_API
 | |
| PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
 | |
| PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
 | |
| #endif /* Py_LIMITED_API */
 | |
| 
 | |
| /* A routine to check if a file descriptor can be select()-ed. */
 | |
| #ifdef _MSC_VER
 | |
|     /* On Windows, any socket fd can be select()-ed, no matter how high */
 | |
|     #define _PyIsSelectable_fd(FD) (1)
 | |
| #else
 | |
|     #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
 | |
| #endif
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| #endif /* !Py_FILEOBJECT_H */
 |