Commit Graph

395 Commits

Author SHA1 Message Date
Georg Brandl 318e62153b Merge #6498 fix from 3.1. 2011-05-15 08:49:29 +02:00
Georg Brandl 0b2489e986 Closes #6498: fix several misspellings of "SystemExit" as "SystemError". 2011-05-15 08:49:12 +02:00
Antoine Pitrou 0d5e52d346 Issue #1856: Avoid crashes and lockups when daemon threads run while the
interpreter is shutting down; instead, these threads are now killed when
they try to take the GIL.
2011-05-04 20:02:30 +02:00
Victor Stinner 3cbf14bfb1 Issue #10914: Initialize correctly the filesystem codec when creating a new
subinterpreter to fix a bootstrap issue with codecs implemented in Python, as
the ISO-8859-15 codec.

Add fscodec_initialized attribute to the PyInterpreterState structure.
2011-04-27 00:24:21 +02:00
Victor Stinner 1188935af9 Issue #10914: Py_NewInterpreter() uses PyErr_PrintEx(0)
... instead of PyErr_Print() because we don't need to set sys attributes,
the sys module is destroyed just after printing the error.
2011-04-27 00:20:27 +02:00
Victor Stinner 9c4efe571d Fix #11586: typo in initfsencoding()
Patch written by Ray Allen.
2011-03-20 23:23:22 +01:00
Victor Stinner 02bfdb3f79 Merged revisions 88530 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88530 | victor.stinner | 2011-02-23 13:07:37 +0100 (mer., 23 févr. 2011) | 4 lines

  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:10:23 +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 3d89751c7a Merged revisions 85980 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85980 | hirokazu.yamamoto | 2010-10-31 00:08:15 +0900 | 1 line

  Issue #10157: Fixed refleaks in pythonrun.c. Patch by Stefan Krah.
........
2010-10-30 15:43:30 +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 c8850d0771 Merged revisions 85817,85904 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85817 | benjamin.peterson | 2010-10-23 22:41:46 -0500 (Sat, 23 Oct 2010) | 1 line

  tighten loop
........
  r85904 | benjamin.peterson | 2010-10-28 22:28:14 -0500 (Thu, 28 Oct 2010) | 1 line

  decrement offset when it points to a newline (#10186 followup)
........
2010-10-29 04:02:30 +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 9831611865 Merged revisions 85814 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85814 | benjamin.peterson | 2010-10-23 21:52:05 -0500 (Sat, 23 Oct 2010) | 1 line

  remove broken code accounting an offset the size of the line #10186
........
2010-10-24 02:57:31 +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 3aa6cea861 Issue #10077: Fix logging of site module errors at startup. 2010-10-23 08:50:36 +00:00
Victor Stinner 15244f7b12 Recorded merge of revisions 85569-85570 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85569 | victor.stinner | 2010-10-16 15:14:10 +0200 (sam., 16 oct. 2010) | 4 lines

  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.
........
  r85570 | victor.stinner | 2010-10-16 15:42:53 +0200 (sam., 16 oct. 2010) | 4 lines

  Fix ast_error_finish() and err_input(): filename can be NULL

  Fix my previous commit (r85569).
........
2010-10-19 01:22:07 +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 b61d5c9758 Merged revisions 83854 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83854 | antoine.pitrou | 2010-08-08 22:46:42 +0200 (dim., 08 août 2010) | 4 lines

  Issue #5319: Print an error if flushing stdout fails at interpreter
  shutdown.
........
2010-08-08 20:49:19 +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 25bb0fdb67 Merged revisions 82059,82061 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r82059 | victor.stinner | 2010-06-18 01:08:50 +0200 (ven., 18 juin 2010) | 5 lines

  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 :-)
........
  r82061 | victor.stinner | 2010-06-18 01:17:37 +0200 (ven., 18 juin 2010) | 2 lines

  Issue #6543: Mention the author of the patch, Amaury Forgeot d'Arc
........
2010-06-17 23:23:37 +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 93362d4e6b Merged revisions 81844 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r81844 | victor.stinner | 2010-06-08 23:00:13 +0200 (mar., 08 juin 2010) | 6 lines

  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:05:20 +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 148051a054 Recorded merge of revisions 81364 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r81364 | victor.stinner | 2010-05-19 22:40:50 +0200 (mer., 19 mai 2010) | 3 lines

  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-20 21:00:34 +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 2e71d014ea Merged revisions 81250-81253 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r81250 | victor.stinner | 2010-05-17 03:13:37 +0200 (lun., 17 mai 2010) | 2 lines

  Issue #6697: Fix a crash if code of "python -c code" contains surrogates
........
  r81251 | victor.stinner | 2010-05-17 03:26:01 +0200 (lun., 17 mai 2010) | 3 lines

  PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead
  of strict) error handler to escape surrogates
........
  r81252 | victor.stinner | 2010-05-17 10:58:51 +0200 (lun., 17 mai 2010) | 6 lines

  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).
........
  r81253 | victor.stinner | 2010-05-17 11:33:42 +0200 (lun., 17 mai 2010) | 6 lines

  Fix refleak in internal_print() introduced by myself in r81251

  _PyUnicode_AsDefaultEncodedString() uses a magical PyUnicode attribute to
  automatically destroy PyUnicode_EncodeUTF8() result when the unicode string is
  destroyed.
........
2010-05-17 09:35:44 +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