comparison Objects/codeobject.c @ 65348:453fd8182c2f

Use locale encoding if Py_FileSystemDefaultEncoding is not set * PyUnicode_EncodeFSDefault(), PyUnicode_DecodeFSDefaultAndSize() and PyUnicode_DecodeFSDefault() use the locale encoding instead of UTF-8 if Py_FileSystemDefaultEncoding is NULL * redecode_filenames() functions and _Py_code_object_list (issue #9630) are no more needed: remove them
author Victor Stinner <victor.stinner@haypocalc.com>
date Fri, 15 Oct 2010 12:04:23 +0000
parents 01b96f78fb70
children 6b8314376de2
comparison
equal deleted inserted replaced
65347:f63d747622bd 65348:453fd8182c2f
2 #include "code.h" 2 #include "code.h"
3 #include "structmember.h" 3 #include "structmember.h"
4 4
5 #define NAME_CHARS \ 5 #define NAME_CHARS \
6 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" 6 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
7
8 PyObject *_Py_code_object_list = NULL;
9 7
10 /* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */ 8 /* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */
11 9
12 static int 10 static int
13 all_name_chars(Py_UNICODE *s) 11 all_name_chars(Py_UNICODE *s)
109 co->co_firstlineno = firstlineno; 107 co->co_firstlineno = firstlineno;
110 Py_INCREF(lnotab); 108 Py_INCREF(lnotab);
111 co->co_lnotab = lnotab; 109 co->co_lnotab = lnotab;
112 co->co_zombieframe = NULL; 110 co->co_zombieframe = NULL;
113 co->co_weakreflist = NULL; 111 co->co_weakreflist = NULL;
114
115 if (_Py_code_object_list != NULL) {
116 int err;
117 PyObject *ref = PyWeakref_NewRef((PyObject*)co, NULL);
118 if (ref == NULL)
119 goto error;
120 err = PyList_Append(_Py_code_object_list, ref);
121 Py_DECREF(ref);
122 if (err)
123 goto error;
124 }
125 } 112 }
126 return co; 113 return co;
127 114
128 error: 115 error:
129 Py_DECREF(co); 116 Py_DECREF(co);