comparison Python/pythonrun.c @ 46107:5341b30b1812 legacy-trunk

Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray ........ r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line Copied files from py3k w/o modifications ........ r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines Take One * Added initialization code, warnings, flags etc. to the appropriate places * Added new buffer interface to string type * Modified tests * Modified Makefile.pre.in to compile the new files * Added bytesobject.c to Python.h ........ r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines Disabled bytearray.extend for now since it causes an infinite recursion Fixed serveral unit tests ........ r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines Added PyBytes support to several places: str + bytearray ord(bytearray) bytearray(str, encoding) ........ r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line Fixed more unit tests related to type('') is not unicode ........ r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines Fixed more unit tests Fixed bytearray.extend ........ r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line Implemented old buffer interface for bytearray ........ r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line Added backport of the io module ........ r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte ........ r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines Fixed more tests Fixed bytearray() comparsion with unicode() Fixed iterator assignment of bytearray ........ r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines str(bytesarray()) now returns the bytes and not the representation of the bytearray object Enabled and fixed more unit tests ........ r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines Clear error PyNumber_AsSsize_t() fails Use CHARMASK for ob_svall access disabled a test with memoryview again ........ r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line Untested updates to the PCBuild directory ........ r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed. ........ r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines Disabled last failing test I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out. ........ r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytes warning code ........ r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass. ........ r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytearray subclassing - all tests are passing. ........
author Christian Heimes <christian@cheimes.de>
date Wed, 26 Mar 2008 12:49:49 +0000
parents 727f743cf630
children c78d3586c474
comparison
equal deleted inserted replaced
46106:20fc41c17cc7 46107:5341b30b1812
70 int Py_DebugFlag; /* Needed by parser.c */ 70 int Py_DebugFlag; /* Needed by parser.c */
71 int Py_VerboseFlag; /* Needed by import.c */ 71 int Py_VerboseFlag; /* Needed by import.c */
72 int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ 72 int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
73 int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */ 73 int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */
74 int Py_NoSiteFlag; /* Suppress 'import site' */ 74 int Py_NoSiteFlag; /* Suppress 'import site' */
75 int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
75 int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */ 76 int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
76 int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */ 77 int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
77 int Py_FrozenFlag; /* Needed by getpath.c */ 78 int Py_FrozenFlag; /* Needed by getpath.c */
78 int Py_UnicodeFlag = 0; /* Needed by compile.c */ 79 int Py_UnicodeFlag = 0; /* Needed by compile.c */
79 int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */ 80 int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
191 Py_FatalError("Py_Initialize: can't init frames"); 192 Py_FatalError("Py_Initialize: can't init frames");
192 193
193 if (!_PyInt_Init()) 194 if (!_PyInt_Init())
194 Py_FatalError("Py_Initialize: can't init ints"); 195 Py_FatalError("Py_Initialize: can't init ints");
195 196
197 if (!PyBytes_Init())
198 Py_FatalError("Py_Initialize: can't init bytearray");
199
196 _PyFloat_Init(); 200 _PyFloat_Init();
197 201
198 interp->modules = PyDict_New(); 202 interp->modules = PyDict_New();
199 if (interp->modules == NULL) 203 if (interp->modules == NULL)
200 Py_FatalError("Py_Initialize: can't make modules dictionary"); 204 Py_FatalError("Py_Initialize: can't make modules dictionary");
249 #ifdef WITH_THREAD 253 #ifdef WITH_THREAD
250 _PyGILState_Init(interp, tstate); 254 _PyGILState_Init(interp, tstate);
251 #endif /* WITH_THREAD */ 255 #endif /* WITH_THREAD */
252 256
253 warnings_module = PyImport_ImportModule("warnings"); 257 warnings_module = PyImport_ImportModule("warnings");
254 if (!warnings_module) 258 if (!warnings_module) {
255 PyErr_Clear(); 259 PyErr_Clear();
260 }
261 else {
262 PyObject *o;
263 char *action[8];
264
265 if (Py_BytesWarningFlag > 1)
266 *action = "error";
267 else if (Py_BytesWarningFlag)
268 *action = "default";
269 else
270 *action = "ignore";
271
272 o = PyObject_CallMethod(warnings_module,
273 "simplefilter", "sO",
274 *action, PyExc_BytesWarning);
275 if (o == NULL)
276 Py_FatalError("Py_Initialize: can't initialize"
277 "warning filter for BytesWarning.");
278 Py_DECREF(o);
279 }
256 280
257 #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) 281 #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET)
258 /* On Unix, set the file system encoding according to the 282 /* On Unix, set the file system encoding according to the
259 user's preference, if the CODESET names a well-known 283 user's preference, if the CODESET names a well-known
260 Python codec, and Py_FileSystemDefaultEncoding isn't 284 Python codec, and Py_FileSystemDefaultEncoding isn't
469 PyCFunction_Fini(); 493 PyCFunction_Fini();
470 PyTuple_Fini(); 494 PyTuple_Fini();
471 PyList_Fini(); 495 PyList_Fini();
472 PySet_Fini(); 496 PySet_Fini();
473 PyString_Fini(); 497 PyString_Fini();
498 PyBytes_Fini();
474 PyInt_Fini(); 499 PyInt_Fini();
475 PyFloat_Fini(); 500 PyFloat_Fini();
476 PyDict_Fini(); 501 PyDict_Fini();
477 502
478 #ifdef Py_USING_UNICODE 503 #ifdef Py_USING_UNICODE