diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-08-26 20:28:21 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-08-26 20:28:21 (GMT) |
commit | 14e461d5b92000ec4e89182fa25ab0d5b5b31234 (patch) | |
tree | 21e37d8661cbe50e7ddbedc1b35a486adc1eae87 /Include | |
parent | 33824f6fd70f89dd39fcb7ed1651e8097c57d340 (diff) | |
download | cpython-14e461d5b92000ec4e89182fa25ab0d5b5b31234.zip cpython-14e461d5b92000ec4e89182fa25ab0d5b5b31234.tar.gz cpython-14e461d5b92000ec4e89182fa25ab0d5b5b31234.tar.bz2 |
Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/ast.h | 5 | ||||
-rw-r--r-- | Include/compile.h | 15 | ||||
-rw-r--r-- | Include/parsetok.h | 42 | ||||
-rw-r--r-- | Include/pyerrors.h | 7 | ||||
-rw-r--r-- | Include/pythonrun.h | 25 | ||||
-rw-r--r-- | Include/symtable.h | 6 | ||||
-rw-r--r-- | Include/warnings.h | 7 |
7 files changed, 97 insertions, 10 deletions
diff --git a/Include/ast.h b/Include/ast.h index 055e8dc..6a8c816 100644 --- a/Include/ast.h +++ b/Include/ast.h @@ -10,6 +10,11 @@ PyAPI_FUNC(mod_ty) PyAST_FromNode( PyCompilerFlags *flags, const char *filename, /* decoded from the filesystem encoding */ PyArena *arena); +PyAPI_FUNC(mod_ty) PyAST_FromNodeObject( + const node *n, + PyCompilerFlags *flags, + PyObject *filename, + PyArena *arena); #ifdef __cplusplus } diff --git a/Include/compile.h b/Include/compile.h index ac2636d..12d75d3 100644 --- a/Include/compile.h +++ b/Include/compile.h @@ -36,7 +36,20 @@ PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx( PyCompilerFlags *flags, int optimize, PyArena *arena); -PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); +PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject( + struct _mod *mod, + PyObject *filename, + PyCompilerFlags *flags, + int optimize, + PyArena *arena); +PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST( + struct _mod * mod, + const char *filename /* decoded from the filesystem encoding */ + ); +PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject( + struct _mod * mod, + PyObject *filename + ); /* _Py_Mangle is defined in compile.c */ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); diff --git a/Include/parsetok.h b/Include/parsetok.h index 911dfc1..68b59bc 100644 --- a/Include/parsetok.h +++ b/Include/parsetok.h @@ -42,10 +42,16 @@ PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, perrdetail *, int); -PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, - const char*, grammar *, - int, char *, char *, - perrdetail *, int); +PyAPI_FUNC(node *) PyParser_ParseFileFlags( + FILE *fp, + const char *filename, /* decoded from the filesystem encoding */ + const char *enc, + grammar *g, + int start, + char *ps1, + char *ps2, + perrdetail *err_ret, + int flags); PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ @@ -56,11 +62,24 @@ PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx( char *ps2, perrdetail *err_ret, int *flags); +PyAPI_FUNC(node *) PyParser_ParseFileObject( + FILE *fp, + PyObject *filename, + const char *enc, + grammar *g, + int start, + char *ps1, + char *ps2, + perrdetail *err_ret, + int *flags); -PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *, - const char *, - grammar *, int, - perrdetail *, int); +PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename( + const char *s, + const char *filename, /* decoded from the filesystem encoding */ + grammar *g, + int start, + perrdetail *err_ret, + int flags); PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx( const char *s, const char *filename, /* decoded from the filesystem encoding */ @@ -68,6 +87,13 @@ PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx( int start, perrdetail *err_ret, int *flags); +PyAPI_FUNC(node *) PyParser_ParseStringObject( + const char *s, + PyObject *filename, + grammar *g, + int start, + perrdetail *err_ret, + int *flags); /* Note that the following functions are defined in pythonrun.c, not in parsetok.c */ diff --git a/Include/pyerrors.h b/Include/pyerrors.h index af37410..a279d81 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -301,9 +301,16 @@ PyAPI_FUNC(void) PyErr_SyntaxLocationEx( const char *filename, /* decoded from the filesystem encoding */ int lineno, int col_offset); +PyAPI_FUNC(void) PyErr_SyntaxLocationObject( + PyObject *filename, + int lineno, + int col_offset); PyAPI_FUNC(PyObject *) PyErr_ProgramText( const char *filename, /* decoded from the filesystem encoding */ int lineno); +PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject( + PyObject *filename, + int lineno); /* The following functions are used to create and modify unicode exceptions from C */ diff --git a/Include/pythonrun.h b/Include/pythonrun.h index 1a40b06..aca5915 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -66,6 +66,12 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromString( int start, PyCompilerFlags *flags, PyArena *arena); +PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject( + const char *s, + PyObject *filename, + int start, + PyCompilerFlags *flags, + PyArena *arena); PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile( FILE *fp, const char *filename, /* decoded from the filesystem encoding */ @@ -76,6 +82,16 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile( PyCompilerFlags *flags, int *errcode, PyArena *arena); +PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject( + FILE *fp, + PyObject *filename, + const char* enc, + int start, + char *ps1, + char *ps2, + PyCompilerFlags *flags, + int *errcode, + PyArena *arena); #endif #ifndef PyParser_SimpleParseString @@ -117,11 +133,20 @@ PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( int start, PyCompilerFlags *flags, int optimize); +PyAPI_FUNC(PyObject *) Py_CompileStringObject( + const char *str, + PyObject *filename, int start, + PyCompilerFlags *flags, + int optimize); #endif PyAPI_FUNC(struct symtable *) Py_SymtableString( const char *str, const char *filename, /* decoded from the filesystem encoding */ int start); +PyAPI_FUNC(struct symtable *) Py_SymtableStringObject( + const char *str, + PyObject *filename, + int start); PyAPI_FUNC(void) PyErr_Print(void); PyAPI_FUNC(void) PyErr_PrintEx(int); diff --git a/Include/symtable.h b/Include/symtable.h index 44535d0..1cfd884 100644 --- a/Include/symtable.h +++ b/Include/symtable.h @@ -16,7 +16,7 @@ typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } struct _symtable_entry; struct symtable { - const char *st_filename; /* name of file being compiled, + PyObject *st_filename; /* name of file being compiled, decoded from the filesystem encoding */ struct _symtable_entry *st_cur; /* current symbol table entry */ struct _symtable_entry *st_top; /* symbol table entry for module */ @@ -74,6 +74,10 @@ PyAPI_FUNC(struct symtable *) PySymtable_Build( mod_ty mod, const char *filename, /* decoded from the filesystem encoding */ PyFutureFeatures *future); +PyAPI_FUNC(struct symtable *) PySymtable_BuildObject( + mod_ty mod, + PyObject *filename, + PyFutureFeatures *future); PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); PyAPI_FUNC(void) PySymtable_Free(struct symtable *); diff --git a/Include/warnings.h b/Include/warnings.h index 5a7dfb1..217c06a 100644 --- a/Include/warnings.h +++ b/Include/warnings.h @@ -17,6 +17,13 @@ PyAPI_FUNC(int) PyErr_WarnFormat( Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); +PyAPI_FUNC(int) PyErr_WarnExplicitObject( + PyObject *category, + PyObject *message, + PyObject *filename, + int lineno, + PyObject *module, + PyObject *registry); PyAPI_FUNC(int) PyErr_WarnExplicit( PyObject *category, const char *message, /* UTF-8 encoded string */ |