Eli Bendersky
07395914ca
Remove call to nonexisting function (relic from Python 2.x) under #ifdef __INSURE__. Issue 9844
2011-01-14 07:31:14 +00:00
Victor Stinner
89e3436606
Issue #10841 : set binary mode on files; the parser translates newlines
...
On Windows, set the binary mode on stdin, stdout, stderr and all
io.FileIO objects (to not translate newlines, \r\n <=> \n). The Python parser
translates newlines (\r\n => \n).
2011-01-07 18:47:22 +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
9d8711964f
#1772833 : add -q command line option.
2010-12-04 10:47:18 +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
Victor Stinner
2f02a51135
PyUnicode_EncodeFS() raises an exception if _Py_wchar2char() fails
...
* Add error_pos optional argument to _Py_wchar2char()
* PyUnicode_EncodeFS() raises a UnicodeEncodeError or MemoryError if
_Py_wchar2char() fails
2010-11-08 22:43:46 +00:00
Antoine Pitrou
9583cac633
Issue #10089 : Add support for arbitrary -X options on the command-line.
...
They can be retrieved through a new attribute `sys._xoptions`.
2010-10-21 13:42:28 +00:00
Victor Stinner
e0f3268715
run_file(): encode the filename with PyUnicode_EncodeFSDefault() instead of
...
PyUnicode_AsUTF8String()
2010-10-17 19:34:51 +00:00
Victor Stinner
168e117e0a
Add an optional size argument to _Py_char2wchar()
...
_Py_char2wchar() callers usually need the result size in characters. Since it's
trivial to compute it in _Py_char2wchar() (O(1) whereas wcslen() is O(n)), add
an option to get it.
2010-10-16 23:16:16 +00:00
Victor Stinner
9a6692f6d7
Py_Main() uses _Py_wchar2char() to encode the filename in error messages
2010-10-14 10:51:24 +00:00
Victor Stinner
8f6b6b0cc3
Issue #9992 : Remove PYTHONFSENCODING environment variable.
2010-10-13 22:02:27 +00:00
Victor Stinner
4e31443c4d
Create fileutils.c/.h
...
* _Py_fopen() and _Py_stat() come from Python/import.c
* (_Py)_wrealpath() comes from Python/sysmodule.c
* _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from Modules/main.c
* (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from Modules/getpath.c
2010-10-07 21:45:39 +00:00
Victor Stinner
4726e40e00
Rewrite RunMainFromImporter()
...
* fix argv0 reference counter if PyList_SetItem() fails
* don't use complex if conditions, but a simple indentation and "goto error"
* simplify error handling (remove Py_XDECREF(importer) from the error label)
* don't set sys_path to NULL (it's useless, sys_path is a borrowed reference
and sys_path is not a static variable)
* try to write only one instruction per line for better readability
2010-10-06 23:24:57 +00:00
Victor Stinner
5c848a84fd
Isse #8589 : Decode PYTHONWARNINGS from utf-8 on Mac OS X
...
Instead of the locale encoding.
2010-09-12 08:00:41 +00:00
Victor Stinner
c2d76fd339
Issue #8589 : surrogateescape error handler is not available at startup
...
Py_Main() uses _Py_wchar2char() + PyUnicode_FromWideChar() instead of
PyUnicode_DecodeFSDefault(), because the PyCodec machinery is not ready yet.
2010-09-10 23:13:52 +00:00
Victor Stinner
9802b39c12
PYTHONFSENCODING is not available on Windows or Mac OS X
2010-08-19 11:36:43 +00:00
Victor Stinner
398356baaa
Improve error message if the command is not decodable
2010-08-18 22:23:22 +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
Nick Coghlan
d26c18adcc
Issue #8202 : Set sys.argv[0] to -m rather than -c while searching for the module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
2010-08-17 13:06:11 +00:00
Victor Stinner
f2e08b34f1
Create _Py_wchar2char() function, reverse of _Py_char2wchar()
...
* Use _Py_wchar2char() in _wstat() and _Py_wfopen()
* Document _Py_char2wchar()
2010-08-13 23:29:08 +00:00
Antoine Pitrou
e9b428f997
Reimplement addbuilddir() in C inside getpath.c, so as to execute it
...
at interpreter startup before importing any non-builtin modules.
Should fix #9589 .
2010-08-13 22:25:01 +00:00
Victor Stinner
0a3ddad666
Issue #9425 : Create run_file() subfunction
...
* Call Py_MakePendingCalls() before converting the filename from
wchar_t* to char*
* Use PyUnicode_AsUTF8String() instead of _PyUnicode_AsString()
2010-08-07 16:34:25 +00:00
Victor Stinner
a62207c584
Issue #9425 : Create run_command() subfunction
...
Use PyUnicode_AsUTF8String() instead of _PyUnicode_AsString()
2010-08-07 10:57:17 +00:00
Victor Stinner
9ca9c25bcd
Issue #8589 : Decode PYTHONWARNINGS environment variable with the file system
...
encoding and surrogateespace error handler instead of the locale encoding to be
consistent with os.environ. Add PySys_AddWarnOptionUnicode() function.
2010-05-19 16:53:30 +00:00
Victor Stinner
6baded49d0
Issue #6697 : Fix a crash if code of "python -c code" contains surrogates
2010-05-17 01:13:37 +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
Ronald Oussoren
d61deca27c
Move _Py_char2wchar from python.c to main.c.
...
This fixes issue #8441 : python.c is not included
in the framework while main.c is and without this
patch you get a link error when building
Python.framework on OSX.
2010-04-18 14:46:12 +00:00
Philip Jenvey
a1bda34cba
strings from _Py_char2wchar need PyMem_Free
2010-04-14 17:03:38 +00:00
Philip Jenvey
e53de3dc4a
#7301 : decode $PYTHONWARNINGS in the same way as argv, test non-ascii values
2010-04-14 03:01:39 +00:00
Benjamin Peterson
ad6139acc7
Merged revisions 79936 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79936 | philip.jenvey | 2010-04-10 15:27:15 -0500 (Sat, 10 Apr 2010) | 3 lines
fix PYTHONWARNINGS handling to not modify the original env value and improve
its tests
........
2010-04-11 21:16:33 +00:00
Philip Jenvey
a9aedd2011
woops these strings aren't kept around, free them
2010-04-07 05:19:21 +00:00
Philip Jenvey
0805ca3f93
Merged revisions 79878-79880 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79878 | philip.jenvey | 2010-04-06 16:24:45 -0700 (Tue, 06 Apr 2010) | 4 lines
#7301 : add the environment variable $PYTHONWARNINGS to supplement the -W
command line option
patch from Brian Curtin
........
r79879 | benjamin.peterson | 2010-04-06 16:32:27 -0700 (Tue, 06 Apr 2010) | 1 line
tell people to update python.man, too
........
r79880 | philip.jenvey | 2010-04-06 16:38:57 -0700 (Tue, 06 Apr 2010) | 1 line
document new PYTHONWARNINGS env var
........
2010-04-07 04:04:10 +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
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
Alexandre Vassalotti
cf7128ccbc
Merged revisions 74051-74052 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74051 | alexandre.vassalotti | 2009-07-17 03:54:23 -0400 (Fri, 17 Jul 2009) | 2 lines
Initialize variables in PyCurses_getsyx() to avoid compiler warnings.
........
r74052 | alexandre.vassalotti | 2009-07-17 04:09:04 -0400 (Fri, 17 Jul 2009) | 3 lines
Fix GCC warning about fprintf used without a string literal and
without format arguments.
........
2009-07-17 08:31:44 +00:00
Ronald Oussoren
3e264e13ed
This fixes issue5143 and includes a test.
...
Issue5143 notes that getpath.c and main.c pass a 'char*' where
a 'wchar_t*' is expected on OSX.
2009-02-12 15:55:38 +00:00
Antoine Pitrou
0560843b8f
Issue #4705 : Fix the -u ("unbuffered binary stdout and stderr") command-line
...
flag to work properly. Furthermore, when specifying -u, the text stdout
and stderr streams have line-by-line buffering enabled (the default being
to buffer arbitrary chunks of data). Patch by Victor Stinner, test by me.
2009-01-09 18:53:14 +00:00
Amaury Forgeot d'Arc
374e220bcb
#4747 : on Windows, starting a module with a non-ascii filename would print a useless "SyntaxError: None"
...
when the script contains a "# coding:" declaration.
The Python API expects char* to be utf-8 encoded. wcstombs should be avoided here.
Reviewed by Benjamin. Will backport to 3.0
2009-01-01 23:05:36 +00:00
Amaury Forgeot d'Arc
9a5499b4e5
#3705 : Command-line arguments were not correctly decoded when the
...
terminal does not use UTF8.
Now the code propagates the unicode string as far as possible, and avoids
the conversion to char* which implicitely uses utf-8.
Reviewed by Benjamin.
2008-11-11 23:04:59 +00:00
Amaury Forgeot d'Arc
dd8059f078
#3626 : On cygwin, starting "python z" would not display any error message:
...
printf("%ls") fails if the wide string is 1 char long :-(
2008-10-30 23:03:32 +00:00
Amaury Forgeot d'Arc
8530e8590f
Revert r33661, which broke all buildbots.
2008-09-09 07:28:22 +00:00
Amaury Forgeot d'Arc
14b785192b
#3705 : Fix crash when given a non-ascii value on the command line for the "-c" and "-m" parameters
...
Second part, for Windows.
Reviewed by Antoine Pitrou
2008-09-09 07:04:36 +00:00
Antoine Pitrou
5651eaa720
Issue #3705 : py3k aborts if "-c" or "-m" is given a non-ascii value.
...
Reviewed by Benjamin Peterson.
2008-09-06 20:46:58 +00:00
Christian Heimes
2ab3444284
Fixed wording of python --help text.
...
The -b option was still using the old name 'buffer' instead of 'bytearray'.
2008-09-03 20:31:07 +00:00
Georg Brandl
e1b5ac6408
Remove meaning of -ttt, but still accept -t option on cmdline for compatibility.
2008-06-04 13:06:58 +00:00
Georg Brandl
a26f8ca668
Revert r63934 -- it was mixing two patches.
2008-06-04 13:01:30 +00:00
Georg Brandl
f954c4b9fb
Remove meaning of -ttt, but still accept -t option on cmdline for compatibility.
2008-06-04 11:41:32 +00:00
Martin v. Löwis
0f5998911c
Forward-port PYTHONIOENCODING.
2008-06-02 11:13:03 +00:00
Christian Heimes
8dc226fccd
Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62774 | georg.brandl | 2008-05-06 19:11:42 +0200 (Tue, 06 May 2008) | 2 lines
#2773 : fix description of 'g' and 'G' formatting spec.
........
r62775 | georg.brandl | 2008-05-06 19:20:54 +0200 (Tue, 06 May 2008) | 2 lines
> != (!<).
........
r62785 | benjamin.peterson | 2008-05-07 00:18:11 +0200 (Wed, 07 May 2008) | 2 lines
Fix logic error in Python/_warnings.c and add a test to verify
........
r62787 | benjamin.peterson | 2008-05-07 00:31:52 +0200 (Wed, 07 May 2008) | 2 lines
Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning
........
r62788 | christian.heimes | 2008-05-07 00:41:46 +0200 (Wed, 07 May 2008) | 1 line
Implemented PEP 370
........
2008-05-06 23:45:46 +00:00
Neal Norwitz
32dde22186
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62055-62058,62060-62066,62068-62074,62076-62079,62081-62083,62086-62089,62092-62094,62098,62101,62104,62106-62109,62115-62122,62124-62125,62128,62130,62132,62134-62135,62137,62139-62140,62144,62146,62151,62155,62157,62162-62166,62171-62172,62175-62176,62178,62181-62186,62188-62192,62196,62200-62203,62206,62211-62213,62215-62218,62222,62224-62226,62228,62232,62236,62240-62245,62248,62250-62254,62256-62258,62262,62264-62265,62267-62270,62272-62276,62280-62288,62291-62292,62299-62301,62307,62312,62316-62318,62322-62331,62333-62337,62339-62344,62346-62348 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62323 | brett.cannon | 2008-04-13 10:09:43 -0700 (Sun, 13 Apr 2008) | 3 lines
Add an explicit check for output in a test to try to diagnose a failure on
Windows.
........
r62324 | brett.cannon | 2008-04-13 10:41:31 -0700 (Sun, 13 Apr 2008) | 3 lines
Fix spliting on colons on Windows machines with a file path by limiting the
number of splits.
........
r62329 | benjamin.peterson | 2008-04-13 13:35:56 -0700 (Sun, 13 Apr 2008) | 2 lines
#2627 Let it be known what pgen generates
........
r62330 | benjamin.peterson | 2008-04-13 13:40:03 -0700 (Sun, 13 Apr 2008) | 2 lines
Added an ignore file for Bazaar #2510
........
r62331 | georg.brandl | 2008-04-13 13:50:29 -0700 (Sun, 13 Apr 2008) | 2 lines
Improve -X error message.
........
r62334 | andrew.kuchling | 2008-04-13 15:39:12 -0700 (Sun, 13 Apr 2008) | 1 line
Add example
........
r62340 | amaury.forgeotdarc | 2008-04-14 12:55:40 -0700 (Mon, 14 Apr 2008) | 2 lines
Update project files for all Windows supported compilers
........
r62341 | amaury.forgeotdarc | 2008-04-14 13:07:48 -0700 (Mon, 14 Apr 2008) | 6 lines
Correct a refleak found by "regrtest.py -R:: test_structmembers"
Some other minor updates in _warnings.c:
- make a function static
- rename a shadowing local variable
........
r62347 | andrew.kuchling | 2008-04-14 19:24:15 -0700 (Mon, 14 Apr 2008) | 1 line
Various items; begin writing the SSL section
........
r62348 | neal.norwitz | 2008-04-14 20:46:21 -0700 (Mon, 14 Apr 2008) | 1 line
Prevent namespace pollution, add static for internal functions
........
2008-04-15 06:43:13 +00:00