Commit Graph

376 Commits

Author SHA1 Message Date
Victor Stinner 7f2fee3640 Issue #10785: Store the filename as Unicode in the Python parser. 2011-04-05 00:39:01 +02:00
Victor Stinner d727e23243 Issue #11393: The fault handler handles also SIGABRT 2011-04-01 12:13:55 +02:00
Victor Stinner 024e37adcc Issue #11393: Add the new faulthandler module 2011-03-31 01:31:06 +02:00
Victor Stinner 4ca2809b5c Fix #11586: typo in initfsencoding()
Patch written by Ray Allen.
2011-03-20 23:09:03 +01:00
Victor Stinner c0f1a1afae Issue #11272: Fix input() and sys.stdin for Windows newline
On Windows, input() strips '\r' (and not only '\n'), and sys.stdin uses
universal newline (replace '\r\n' by '\n').
2011-02-23 12:07:37 +00:00
Victor Stinner 0fcab4a3ed Issue #9566: use Py_ssize_t instead of int 2011-01-04 12:59:15 +00:00
Georg Brandl 8aa7e999b5 Add sys.flags.quiet attribute for the new -q option, as noted missing by Eric in #1772833. 2010-12-28 18:30:18 +00:00
Georg Brandl 8334fd9285 Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile. 2010-12-04 10:26:46 +00:00
Martin v. Löwis 4d0d471a80 Merge branches/pep-0384. 2010-12-03 20:14:31 +00:00
Georg Brandl e5b99f0fb3 Remove redundant includes of headers that are already included by Python.h. 2010-11-30 09:41:01 +00:00
Antoine Pitrou 5a96b5241f Issue #10255: Fix reference leak in Py_InitializeEx(). Patch by Neil
Schemenauer.
2010-11-20 19:50:57 +00:00
Antoine Pitrou cf9f98034a Issue #10372: Import the warnings module only after the IO library is
initialized, so as to avoid bootstrap issues with the '-W' option.
2010-11-10 13:55:25 +00:00
Hirokazu Yamamoto daf83acf00 Issue #10157: Fixed refleaks in pythonrun.c. Patch by Stefan Krah. 2010-10-30 15:08:15 +00:00
Benjamin Peterson a95e977e41 decrement offset when it points to a newline (#10186 followup) 2010-10-29 03:28:14 +00:00
Benjamin Peterson d4519c14ca tighten loop 2010-10-24 03:41:46 +00:00
Benjamin Peterson 503d6c5ae9 remove broken code accounting an offset the size of the line #10186 2010-10-24 02:52:05 +00:00
Victor Stinner e474309bb7 initfsencoding(): get_codeset() failure is now a fatal error
Don't fallback to utf-8 anymore to avoid mojibake. I never got any error from
his function.
2010-10-19 00:05:51 +00:00
Victor Stinner 49d3f2514b _PyImport_FixupExtension() and _PyImport_FindExtension() uses FS encoding
* Rename _PyImport_FindExtension() to _PyImport_FindExtensionUnicode():
   the filename becomes a Unicode object instead of byte string
 * Rename _PyImport_FixupExtension() to _PyImport_FixupExtensionUnicode():
   the filename becomes a Unicode object instead of byte string
2010-10-17 01:24:53 +00:00
Victor Stinner 2f2ed1f36c Fix ast_error_finish() and err_input(): filename can be NULL
Fix my previous commit (r85569).
2010-10-16 13:42:53 +00:00
Victor Stinner 4c7c8c3023 Issue #9713, #10114: Parser functions (eg. PyParser_ASTFromFile) expects
filenames encoded to the filesystem encoding with surrogateescape error handler
(to support undecodable bytes), instead of UTF-8 in strict mode.
2010-10-16 13:14:10 +00:00
Victor Stinner f3170ccef8 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
2010-10-15 12:04:23 +00:00
Victor Stinner 6a4aff10f0 redecode_filename(): don't need to initialize variables 2010-10-15 11:16:59 +00:00
Victor Stinner 8f6b6b0cc3 Issue #9992: Remove PYTHONFSENCODING environment variable. 2010-10-13 22:02:27 +00:00
Victor Stinner c39211f51e Issue #9630: Redecode filenames when setting the filesystem encoding
Redecode the filenames of:

 - all modules: __file__ and __path__ attributes
 - all code objects: co_filename attribute
 - sys.path
 - sys.meta_path
 - sys.executable
 - sys.path_importer_cache (keys)

Keep weak references to all code objects until initfsencoding() is called, to
be able to redecode co_filename attribute of all code objects.
2010-09-29 16:35:47 +00:00
Antoine Pitrou b0b384b7c0 Issue #9901: Destroying the GIL in Py_Finalize() can fail if some other
threads are still running.  Instead, reinitialize the GIL on a second
call to Py_Initialize().
2010-09-20 20:13:48 +00:00
Antoine Pitrou 1df1536fb9 Issue #9828: Destroy the GIL in Py_Finalize(), so that it gets properly
re-created on a subsequent call to Py_Initialize().  The problem (a crash)
wouldn't appear in 3.1 or 2.7 where the GIL's structure is more trivial.
2010-09-13 14:16:46 +00:00
Victor Stinner 94908bbc15 Issue #8622: Add PYTHONFSENCODING environment variable to override the
filesystem encoding.

initfsencoding() displays also a better error message if get_codeset() failed.
2010-08-18 21:23:25 +00:00
Victor Stinner 6961bd690e Issue #8063: Call _PyGILState_Init() earlier in Py_InitializeEx(). 2010-08-17 22:26:51 +00:00
Antoine Pitrou 696e03553b Issue #477863: Print a warning at shutdown if gc.garbage is not empty. 2010-08-08 22:18:46 +00:00
Antoine Pitrou bddc9fe22b Issue #5319: Print an error if flushing stdout fails at interpreter
shutdown.
2010-08-08 20:46:42 +00:00
Alexander Belopolsky 6fc4ade2bb Issue #9079: Added _PyTime_gettimeofday(_PyTime_timeval *tp) to C API
exposed in Python.h.  This function is similar to POSIX
gettimeofday(struct timeval *tp), but available on platforms without
gettimeofday().
2010-08-05 17:34:27 +00:00
Victor Stinner 0fe25a445d Issue #6543: Write the traceback in the terminal encoding instead of utf-8.
Fix the encoding of the modules filename.

Reindent also traceback.h, just because I hate tabs :-)
2010-06-17 23:08:50 +00:00
Victor Stinner 7f84ab5952 Issue #8965: initfsencoding() doesn't change the encoding on Mac OS X
File system encoding have to be hardcoded to "utf-8" on Mac OS X. r81190
introduced a regression: the encoding was changed depending on the locale.
2010-06-11 00:36:33 +00:00
Victor Stinner 55a5c78e4d Py_FatalError(): don't sys sys.last_xxx variables
Call PyErr_PrintEx(0) instead of PyErr_Print() to avoid a crash if
Py_FatalError() is called in an early stage of Python initialization (if PySys
is not yet initialized).
2010-06-08 21:00:13 +00:00
Victor Stinner 7126dbc867 Issue #3798: sys.exit(message) writes the message to sys.stderr file, instead
of the C file stderr, to use stderr encoding and error handler
2010-05-21 23:45:42 +00:00
Victor Stinner 7d79b8b771 Issue #8766: Initialize _warnings module before importing the first module.
Fix a crash if an empty directory called "encodings" exists in sys.path.
2010-05-19 20:40:50 +00:00
Victor Stinner 386fe71de1 Issue #6697: Check that _PyUnicode_AsString() result is not NULL 2010-05-19 00:34:15 +00:00
Victor Stinner e9fb319e68 handle_system_exit() flushs files to warranty the output order
PyObject_Print() writes into the C object stderr, whereas PySys_WriteStderr()
writes into the Python object sys.stderr. Each object has its own buffer, so
call sys.stderr.flush() and fflush(stderr).
2010-05-17 08:58:51 +00:00
Victor Stinner b744ba1d14 Issue #8610: Load file system codec at startup, and display a fatal error on
failure. Set the file system encoding to utf-8 (instead of None) if getting
the locale encoding failed, or if nl_langinfo(CODESET) function is missing.
2010-05-15 12:27:16 +00:00
Victor Stinner 9467b212f5 Issue #4653: fix typo in flush_std_files()
Don't call sys.stderr.flush() if sys has no stderr attribute or if
sys.stderr==None.
2010-05-14 00:59:09 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Jean-Paul Calderone 6f137ca469 Merged revisions 81007 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81007 | jean-paul.calderone | 2010-05-08 16:06:02 -0400 (Sat, 08 May 2010) | 1 line

  Skip signal handler re-installation if it is not necessary.  Issue 8354.
........
2010-05-09 03:18:57 +00:00
Victor Stinner b001df0040 err_input(): don't encode/decode the unicode message 2010-05-08 00:07:07 +00:00
Barry Warsaw 28a691b7fd PEP 3147 2010-04-17 00:19:56 +00:00
Gregory P. Smith fb94c5f1e5 * Replaces the internals of the subprocess module from fork through exec on
POSIX systems with a C extension module.  This is required in order for
  the subprocess module to be made thread safe.

  The pure python implementation is retained so that it can continue to be
  used if for some reason the _posixsubprocess extension module is not
  available.

  The unittest executes tests on both code paths to guarantee compatibility.

* Moves PyLong_FromPid and PyLong_AsPid from posixmodule.c into longobject.h.

Code reviewed by jeffrey.yasskin at http://codereview.appspot.com/223077/show
2010-03-14 06:49:55 +00:00
Victor Stinner 52f6dd7a3d Merged revisions 78826 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78826 | victor.stinner | 2010-03-10 23:30:19 +0100 (mer., 10 mars 2010) | 5 lines

  Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt
  (SIGINT). If an error occurs while importing the site module, the error is
  printed and Python exits. Initialize the GIL before importing the site
  module.
........
2010-03-12 14:45:56 +00:00
Andrew M. Kuchling b2ceb3ad9e #4532: fixes to make 3.x compile on QNX 6.3.2 (reported by Matt Kraai) 2010-02-22 23:26:10 +00:00
Antoine Pitrou 7b0d4a238f Issue #4486: When an exception has an explicit cause, do not print its implicit context too. 2009-11-28 16:12:28 +00:00
Antoine Pitrou 011bd62c8c Merged revisions 75570 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75570 | antoine.pitrou | 2009-10-20 23:29:37 +0200 (mar., 20 oct. 2009) | 6 lines

  Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which
  fixes the problem of some exceptions being thrown at shutdown when the
  interpreter is killed. Patch by Adam Olsen.
........
2009-10-20 21:52:47 +00:00
Benjamin Peterson cc3b8d6883 bytes -> bytearray 2009-05-10 23:43:14 +00:00