Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Raymond Hettinger
29dcaad6eb
Issue 11510: Fix BUILD_SET optimizer bug.
2011-03-15 14:50:16 -07:00
Ezio Melotti
4969f709cc
#11515 : Merge with 3.1.
2011-03-15 05:59:46 +02:00
Ezio Melotti
42da663e6f
#11515 : fix several typos. Patch by Piotr Kasprzyk.
2011-03-15 05:18:48 +02:00
Victor Stinner
fe93faf98c
Issue #3080 : Add PyImport_ImportModuleLevelObject() function
...
Use it for the builtin __import__ function.
2011-03-14 15:54:52 -04:00
Victor Stinner
98dbba5d20
Issue #3080 : Use repr() to format the module name on error
2011-03-14 15:15:47 -04:00
Victor Stinner
ccbf475dfd
Fix imp.cache_from_source() if the directory name contains a dot
...
If the directory name contains a dot but not the filename, don't strip at the
dot.
2011-03-14 15:05:12 -04:00
Victor Stinner
fe19d21815
Issue #3080 : imp.new_module() uses Unicode
2011-03-14 14:53:28 -04:00
Victor Stinner
2fd76e478f
Issue #3080 : find_module() returns the path as Unicode
2011-03-14 15:19:39 -04:00
Victor Stinner
c9a271cf2b
Issue #3080 : case_ok() expects Unicode strings
2011-03-14 14:34:13 -04:00
Victor Stinner
547a2a6d52
Issue #3080 : find_init_module() expects Unicode
2011-03-20 03:07:28 +01:00
Victor Stinner
d029621c70
Issue #3080 : Refactor find_module_path(), use return instead of break
...
Prepare also the API change of case_ok()
2011-03-14 14:04:10 -04:00
Victor Stinner
df75a023a0
Issue #3080 : find_module() sets an empty path for builtin and frozen modules
2011-03-14 13:40:04 -04:00
Victor Stinner
533d78399f
Issue #3080 : Rename some path variables to path_list
2011-03-14 13:22:54 -04:00
Victor Stinner
ad3c03b23e
Issue #3080 : find_module() expects module fullname and subname as Unicode
...
And PyImport_ReloadModule() uses Unicode for the module name.
2011-03-14 09:21:33 -04:00
Victor Stinner
58d37112ae
Issue #3080 : Drop OS/2 support for the import machinery
...
Sorry Andrew I MacIntyre!
2011-03-13 23:11:02 -04:00
Victor Stinner
9599de5110
Issue #3080 : Reindent and simplify import_submodule()
2011-03-13 22:38:38 -04:00
Victor Stinner
c24c8108b6
Issue #3080 : Use %R to format module name in error messages
...
%R format instead of %U
2011-03-13 22:38:06 -04:00
Victor Stinner
974389d92c
Issue #3080 : Use Unicode for the "The Magnum Opus of dotted-name import"
...
Use Unicode for module name and paths in the following functions:
* PyImport_ImportModuleLevel()
* add_submodule()
* ensure_from_list()
* get_parent()
* import_module_level()
* import_submodule()
* load_next()
* mark_miss()
2011-03-15 09:33:57 +01:00
Victor Stinner
2e5f11aaa4
Issue #3080 : PyImport_ImportModuleNoBlock() uses Unicode
2011-03-13 21:57:27 -04:00
Victor Stinner
41c5fecce0
Issue #3080 : load_module() expects name and path as Unicode
2011-03-13 21:46:30 -04:00
Victor Stinner
2f42ae53aa
Issue #3080 : Use Unicode to import source and compiled modules
...
* Use Unicode for module name and path in the following functions:
* get_file()
* load_source_module(), parse_source_module()
* make_compiled_pathname(), check_compiled_module(),
read_compiled_module(), load_compiled_module(), write_compiled_module(),
update_compiled_module()
* On Windows, use CreateDirectoryW() instead of mkdir()
* update_compiled_module() cannot fail anymore
2011-03-20 00:41:24 +01:00
Victor Stinner
c9abda0c04
Issue #3080 : get_sourcefile(), make_source_pathname(), load_package()
...
Use Unicode for module name and path in get_sourcefile(),
make_source_pathname() and load_package() functions.
2011-03-14 13:33:46 -04:00
Victor Stinner
d68c2cf237
Issue #3080 : Create find_module_path() subfunction
2011-03-12 16:02:28 -05:00
Victor Stinner
3758028299
Issue #3080 : Create find_module_path_list() subfunction
2011-03-20 01:34:43 +01:00
Victor Stinner
c696316466
Issue #3080 : Remove useless name buffer from find_module()
...
Rename subname argument to name, and mark it as constant.
2011-03-12 09:26:54 -05:00
Victor Stinner
7d8b77c2aa
Issue #3080 : find_module() initialize buf and *p_fp
...
Document also the find_module() function
2011-03-12 08:45:02 -05:00
Victor Stinner
fefd70c40d
Issue #3080 : _PyImport_LoadDynamicModule() uses Unicode for name and path
...
Document also that dynamic module names are ASCII only
2011-03-14 15:54:07 -04:00
Victor Stinner
4d6c1c476a
Issue #3080 : _PyWin_FindRegisteredModule() returns the path as Unicode
...
* Document the function
* Use RegQueryValueW() instead of RegQueryValueA()
* Use _Py_fopen() instead of fopen()
* Allocate registry key on the heap, not on the stack, and handle memory
allocation failure
* Handle Python exception in find_module()
2011-03-08 23:49:04 +01:00
Victor Stinner
21fcd0c9af
Issue #3080 : Use PyUnicode_InternFromString() for builtins
...
_PyImport_FixupBuiltin() and _PyImport_FindBuiltin() use
PyUnicode_InternFromString() instead of PyUnicode_FromString().
2011-03-07 18:28:15 +01:00
Victor Stinner
9587286f98
Issue #3080 : Import builtins using Unicode strings
...
- is_builtin(), init_builtin(), load_builtin() and other builtin related
functions use Unicode strings, instead of byte strings
- Rename _PyImport_FixupExtensionUnicode() to _PyImport_FixupExtensionObject()
- Rename _PyImport_FindExtensionUnicode() to _PyImport_FindExtensionObject()
2011-03-07 18:20:56 +01:00
Victor Stinner
53dc735168
Issue #3080 : Add PyImport_ImportFrozenModuleObject()
...
find_frozen(), get_frozen_object(), is_frozen_package() and other functions
related to frozen modules use Unicode strings instead of byte strings.
2011-03-20 01:50:21 +01:00
Victor Stinner
9464d61cba
Issue #3080 : PyImport_Cleanup() uses Unicode
...
Replace strcmp() by PyUnicode_CompareWithASCIIString()
2011-03-07 17:08:21 +01:00
Victor Stinner
942003ccf9
import.c: replace tab by spaces
2011-03-07 16:57:48 +01:00
Ezio Melotti
b88ed1549e
#11565 : Merge with 3.2.
2011-03-16 11:38:59 +02:00
Raymond Hettinger
0661e91fed
Issue 11510: Fix BUILD_SET optimizer bug.
2011-03-15 15:03:36 -07:00
Ezio Melotti
373089239b
#11515 : Merge with 3.2.
2011-03-15 06:03:08 +02:00
Jesus Cea
736e7fc0f6
Issue #11495 : OSF support is eliminated. It was deprecated in Python 3.2
2011-03-14 17:36:54 +01:00
Benjamin Peterson
c9723d09eb
use only the hex version, since the revno is unreliable across repos
2011-03-13 16:36:08 -05:00
Benjamin Peterson
678da9fefb
bump ast version
2011-03-12 18:35:23 -06:00
Benjamin Peterson
6cb2b923e0
convert ast versioning to mercurial
2011-03-12 18:28:16 -06:00
Antoine Pitrou
17b880a5d6
Issue #11244 : The peephole optimizer is now able to constant-fold
...
arbitrarily complex expressions. This also fixes a 3.2 regression where
operations involving negative numbers were not constant-folded.
2011-03-11 17:27:02 +01:00
Georg Brandl
776e586114
Remove sys.subversion and svn build identification leftovers.
2011-03-06 10:35:42 +01:00
Georg Brandl
fe09a54280
Merge build identification to default branch.
2011-03-06 10:26:32 +01:00
Georg Brandl
13039c87f1
Merge build identification to 3.2 branch.
2011-03-06 10:13:00 +01:00
Georg Brandl
1ca2e7965c
Commit the hg build identification patch from the pymigr repo.
2011-03-05 20:51:24 +01:00
Victor Stinner
27ee089c35
Issue #3080 : Add PyImport_AddModuleObject() and PyImport_ExecCodeModuleObject()
2011-03-04 12:57:09 +00:00
Victor Stinner
f3fd733f92
Remove useless argument of _PyUnicode_AsDefaultEncodedString()
2011-03-02 01:03:11 +00:00
Georg Brandl
3f0df3bc51
Merged revisions 88430 via svnmerge from
...
svn+ssh://svn.python.org/python/branches/py3k
........
r88430 | georg.brandl | 2011-02-15 20:48:59 +0100 (Di, 15 Feb 2011) | 1 line
#730467 : Another small AIX fix.
........
2011-02-25 10:22:44 +00: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
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
3eeee83391
dynload_dl.c: replace tabs by spaces
2011-02-23 11:29:28 +00:00
Victor Stinner
501c09a754
Issue #3080 : Mark _PyImport_FindBuiltin() argument as constant
...
And as a consequence, mark also name argument of
_PyImport_FindExtensionUnicode() constant too. But I plan to change this
argument type to PyObject* later.
2011-02-23 00:02:00 +00:00
Victor Stinner
42040fb665
Issue #3080 : Remove unused argument of _PyImport_GetDynLoadFunc()
...
The first argument, fqname, was not used.
2011-02-22 23:16:19 +00:00
Victor Stinner
9b99b448f7
Issue #3080 : Mark PyWin_FindRegisteredModule() as private
...
This function was not declared in Python public API (in any .h file) and not
documented. Mark it as private to prepare a change of its API.
2011-02-22 23:12:28 +00:00
Brett Cannon
b94767ff44
Issue #8914 : fix various warnings from the Clang static analyzer v254.
2011-02-22 20:15:44 +00:00
Victor Stinner
ed4c71112a
Remove filename variable from ceval.c
...
Issue #11168 : Remove filename debug variable from PyEval_EvalFrameEx().
It encoded the Unicode filename to UTF-8, but the encoding fails on
undecodable filename (on surrogate characters) which raises an unexpected
UnicodeEncodeError on recursion limit.
2011-02-21 21:05:50 +00:00
Georg Brandl
59e87bd251
#730467 : Another small AIX fix.
2011-02-15 19:48:59 +00:00
Antoine Pitrou
6a002c02da
Fix the GIL with subinterpreters. Hopefully this will allow mod_wsgi to work with 3.2.
...
(we need some tests for this)
2011-01-15 11:37:11 +00:00
David Malcolm
8ad4cd90e9
Merged revisions 87796 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87796 | david.malcolm | 2011-01-06 12:01:36 -0500 (Thu, 06 Jan 2011) | 6 lines
Issue #10655 : Fix the build on PowerPC on Linux with GCC when building with
timestamp profiling (--with-tsc): the preprocessor test for the PowerPC
support now looks for "__powerpc__" as well as "__ppc__": the latter seems to
only be present on OS X; the former is the correct one for Linux with GCC.
........
2011-01-06 17:36:32 +00:00
David Malcolm
f1397ad399
Issue #10655 : Fix the build on PowerPC on Linux with GCC when building with
...
timestamp profiling (--with-tsc): the preprocessor test for the PowerPC
support now looks for "__powerpc__" as well as "__ppc__": the latter seems to
only be present on OS X; the former is the correct one for Linux with GCC.
2011-01-06 17:01:36 +00:00
Raymond Hettinger
90e8f8cd9b
Fix count of flag fields. Being one short caused the 'quiet' option not to print.
2011-01-05 20:08:25 +00:00
Victor Stinner
0fcab4a3ed
Issue #9566 : use Py_ssize_t instead of int
2011-01-04 12:59:15 +00:00
Victor Stinner
6ab8e8298e
Issue #8992 : convertsimple() doesn't need to fill msgbuf if an error occurred
...
Return msgbug on error is enough.
2011-01-04 11:16:49 +00:00
Victor Stinner
a093d0d6a9
Issue #8992 : Simplify addcleanup() API
...
Don't need to handle unknown destructor anymore.
2011-01-04 11:16:48 +00:00
Victor Stinner
b3c9e073fc
Issue #8651 : PyArg_Parse*() functions raise an OverflowError if the file
...
doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
(length bigger than 2^31-1).
2011-01-04 02:07:34 +00:00
Benjamin Peterson
beef5dcf77
Merged revisions 87607 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87607 | benjamin.peterson | 2011-01-01 08:28:31 -0600 (Sat, 01 Jan 2011) | 1 line
update copyright to 2011
........
2011-01-01 15:32:26 +00:00
Benjamin Peterson
834cb394c3
update copyright to 2011
2011-01-01 14:28:31 +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
Victor Stinner
92be939695
Issue #10780 : PyErr_SetFromWindowsErrWithFilename() and
...
PyErr_SetExcFromWindowsErrWithFilename() decode the filename from the
filesystem encoding instead of UTF-8.
2010-12-28 00:28:21 +00:00
Victor Stinner
cb428f0162
Issue #10779 : PyErr_WarnExplicit() decodes the filename from the filesystem
...
encoding instead of UTF-8.
2010-12-27 20:10:36 +00:00
Antoine Pitrou
810023db3e
Issue #8844 : Regular and recursive lock acquisitions can now be interrupted
...
by signals on platforms using pthreads. Patch by Reid Kleckner.
2010-12-15 22:59:16 +00:00
Victor Stinner
13d49ee7d6
Issue #10601 : sys.displayhook uses 'backslashreplace' error handler on
...
UnicodeEncodeError.
2010-12-04 17:24:33 +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
Victor Stinner
ebc0052e3a
import: use PyUnicode_FSConverter to support bytes path and PEP 383
...
(instead of PyArg_Parse*() with "es" format and Py_FileSystemDefaultEncoding)
2010-12-03 17:06:43 +00:00
Nick Coghlan
b2ddf7979d
Issue #9573 : os.fork now works when triggered as a side effect of import (the wisdom of actually relying on this remains questionable!)
2010-12-02 04:11:46 +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
Georg Brandl
71c23d4473
Include structseq.h in Python.h, and remove now-redundant includes in individual sources.
2010-11-30 09:30:54 +00:00
Antoine Pitrou
e71362d3de
Issue #10518 : Bring back the callable() builtin.
...
Approved by Guido (BDFL) and Georg (RM).
2010-11-27 22:00:11 +00:00
Benjamin Peterson
0a4dae5309
fix refleak
2010-11-21 15:12:34 +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
Benjamin Peterson
787cddc93d
Merged revisions 86545 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86545 | benjamin.peterson | 2010-11-19 22:31:07 -0600 (Fri, 19 Nov 2010) | 1 line
new plan: functions that want 'tmp' can declare it
........
2010-11-20 04:37:00 +00:00
Benjamin Peterson
d8f6597318
new plan: functions that want 'tmp' can declare it
2010-11-20 04:31:07 +00:00
Benjamin Peterson
e82c169622
Merged revisions 86540 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86540 | benjamin.peterson | 2010-11-19 20:01:45 -0600 (Fri, 19 Nov 2010) | 1 line
c89 declarations
........
2010-11-20 02:04:14 +00:00
Benjamin Peterson
0e9e98edc7
c89 declarations
2010-11-20 02:01:45 +00:00
Benjamin Peterson
aab9585130
Merged revisions 86538 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86538 | benjamin.peterson | 2010-11-19 19:38:49 -0600 (Fri, 19 Nov 2010) | 1 line
use %R format code; fixes invalid dereferencing #10391
........
2010-11-20 01:48:38 +00:00
Benjamin Peterson
5b066817e2
use %R format code; fixes invalid dereferencing #10391
2010-11-20 01:38:49 +00:00
Benjamin Peterson
f609654b0e
handle dict subclasses gracefully in PyArg_ValidateKeywordArguments
2010-11-17 22:33:12 +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
Victor Stinner
3e2b7171bf
Issue #10359 : Remove ";" after function definition, invalid in ISO C
2010-11-09 09:32:19 +00:00
Victor Stinner
19de4c3a8c
_Py_char2wchar() frees the memory on conversion error
...
Explain in the documentation that conversion errors should never happen.
2010-11-08 23:30:46 +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
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
Antoine Pitrou
98e2b45297
Merged revisions 85896 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85896 | antoine.pitrou | 2010-10-29 00:56:58 +0200 (ven., 29 oct. 2010) | 4 lines
Issue #5437 : A preallocated MemoryError instance should not hold traceback
data (including local variables caught in the stack trace) alive infinitely.
........
2010-10-28 23:06:57 +00:00
Antoine Pitrou
07e20ef50b
Issue #5437 : A preallocated MemoryError instance should not hold traceback
...
data (including local variables caught in the stack trace) alive infinitely.
2010-10-28 22:56:58 +00:00
Victor Stinner
07e4f1565b
sys_update_path(): update sys.path even if argc==0
2010-10-25 17:37:23 +00:00
Georg Brandl
08be72d0aa
Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default,
...
except when configured --with-pydebug.
Emit this warning from the GC shutdown procedure, rather than just printing to stderr.
2010-10-24 15:11:22 +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
Benjamin Peterson
8035bc5c04
follow up to #9778 : define and use an unsigned hash type
2010-10-23 16:20:50 +00:00
Victor Stinner
3aa6cea861
Issue #10077 : Fix logging of site module errors at startup.
2010-10-23 08:50:36 +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
Benjamin Peterson
4d3d08f961
Merged revisions 85757 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85757 | benjamin.peterson | 2010-10-20 16:25:23 -0500 (Wed, 20 Oct 2010) | 1 line
fix uninitialized struct member #10152
........
2010-10-20 21:35:05 +00:00
Benjamin Peterson
b8ffb60ec6
fix uninitialized struct member #10152
2010-10-20 21:25:23 +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
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Victor Stinner
c049982ea5
compiler_error(): use PyUnicode_DecodeFSDefault() to decode the filename,
...
instead of utf-8 in strict mode.
2010-10-17 19:16:33 +00:00
Victor Stinner
15a71cdad2
PyErr_SyntaxLocationEx() uses PyUnicode_DecodeFSDefault(), instead of
...
PyUnicode_FromString(), to decode the filename.
2010-10-17 19:03:16 +00:00
Victor Stinner
ed7916dd00
find_module(): use FS encoding to display the missing __init__ warning
2010-10-17 02:07:09 +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
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
0a1b8cba90
_Py_wrealpath() uses _Py_char2wchar() to decode the result, to support
...
surrogate characters.
2010-10-16 22:55:47 +00:00
Victor Stinner
350147b5ca
_Py_wreadlink(): catch _Py_char2wchar() failure
2010-10-16 22:52:09 +00:00
Victor Stinner
3f711f4a3e
_Py_wreadlink() uses _Py_char2wchar() to decode the result, to support
...
surrogate characters.
2010-10-16 22:47:37 +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
Benjamin Peterson
e9633491ca
Merged revisions 85562 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85562 | benjamin.peterson | 2010-10-15 22:45:45 -0500 (Fri, 15 Oct 2010) | 1 line
don't identify the toplevel namespace by name #9997
........
2010-10-16 03:49:22 +00:00
Benjamin Peterson
230b20684f
don't identify the toplevel namespace by name #9997
2010-10-16 03:45:45 +00:00
Benjamin Peterson
294a9fcba6
fix refleak
2010-10-16 03:12:39 +00:00
Barry Warsaw
8cf4eae522
First (uncontroversial) part of issue 9807.
...
* Expose the build flags to Python as sys.abiflags
* Shared library libpythonX.Y<abiflags>.so
* python-config --abiflags
* Make two distutils tests that failed with --enable-shared (even before this
patch) succeed.
* Fix a few small style issues.
2010-10-16 01:04:07 +00:00
Victor Stinner
88bd891e6c
Fix imp_cache_from_source(): Decode make_compiled_pathname() result from the
...
filesystem encoding instead of utf-8.
imp_cache_from_source() encodes the input path to filesystem encoding and this
path is passed to make_compiled_pathname().
2010-10-15 22:46:07 +00:00
Victor Stinner
1a5630326f
imp_load_module() uses PyUnicode_FSConverter() to support surrogates in module
...
path
2010-10-15 22:43:10 +00:00
Victor Stinner
3ea23ddabf
imp.cache_from_source() uses PyUnicode_FSConverter() to support surrogates in
...
module path
2010-10-15 20:34:32 +00:00
Victor Stinner
8dbf629bbd
imp.load_dynamic() uses PyUnicode_FSConverter() to support surrogates
...
in the library path.
2010-10-15 12:48:01 +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
5d1e3438cd
Mark _Py_char2wchar() input argument as constant
2010-10-15 11:15:54 +00:00
Antoine Pitrou
3d400b7a58
Merged revisions 85497 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85497 | antoine.pitrou | 2010-10-14 23:15:17 +0200 (jeu., 14 oct. 2010) | 3 lines
Explicitly close some files (from issue #10093 )
........
2010-10-14 21:17:39 +00:00
Antoine Pitrou
b86680e299
Explicitly close some files (from issue #10093 )
2010-10-14 21:15:17 +00:00
Victor Stinner
f4061dac60
_Py_wgetcwd() decodes the path using _Py_char2wchar() to support surrogates
2010-10-14 12:37:19 +00:00
Victor Stinner
8f6b6b0cc3
Issue #9992 : Remove PYTHONFSENCODING environment variable.
2010-10-13 22:02:27 +00:00
Victor Stinner
a00064576a
ceval.c: catch recursion error on _PyUnicode_AsString(co->co_filename)
2010-10-13 10:48:55 +00:00
Antoine Pitrou
19f8edc39d
Issue #10062 : Allow building on platforms which do not have sem_timedwait.
2010-10-10 08:37:22 +00:00
Victor Stinner
6672d0c5bb
fileutils.c: document which encodings are used
2010-10-07 22:53:43 +00:00
Victor Stinner
015f4d87ab
_Py_wrealpath() requires the size of the output buffer
2010-10-07 22:29:53 +00:00
Victor Stinner
a4a759515e
_Py_stat() and _Py_fopen(): avoid PyUnicode_AsWideCharString() on Windows
...
On Windows, Py_UNICODE is wchar_t, so we can avoid the expensive Py_UNICODE*
=> wchar_t* conversion.
2010-10-07 22:23:10 +00:00
Victor Stinner
b306d7594f
Fix fileutils for Windows
...
* Don't define _Py_wstat() on Windows, Windows has its own _wstat() function
with a different API (the stat buffer has another type)
* Include windows.h
2010-10-07 22:09:40 +00:00
Victor Stinner
e7c8083bf1
Ooops, fileutils.c contains twice the same code
...
I suppose that I reapplied my local patch creating Python/fileutils.c whereas
the file already existed.
2010-10-07 21:55:44 +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
7ae7c87b05
_wrealpath() and _Py_wreadlink() support surrogates (PEP 383)
...
Use _Py_wchar2char() to support surrogate characters in the input path.
2010-10-07 11:06:49 +00:00
Victor Stinner
beb4135b8c
PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*
...
All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the
prototype for the new function PyUnicode_AsWideCharString().
2010-10-07 01:02:42 +00:00
Victor Stinner
c08ec9fdba
Create a subfunction for PySys_SetArgvEx()
...
Create sys_update_path() static function. Do nothing if argc==0.
2010-10-06 22:44:06 +00:00
Amaury Forgeot d'Arc
7955fb638a
Merged revisions 85236 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85236 | amaury.forgeotdarc | 2010-10-06 00:15:37 +0200 (mer., 06 oct. 2010) | 2 lines
#9060 Let platforms without dup2() compile the replacement fonction without error.
........
2010-10-05 22:18:29 +00:00
Amaury Forgeot d'Arc
90774dd47b
#9060 Let platforms without dup2() compile the replacement fonction without error.
2010-10-05 22:15:37 +00:00
Brian Curtin
748cacee46
Remove an unreferenced variable. len is no longer needed.
2010-09-29 19:09:33 +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
Victor Stinner
255dfdb5ce
Issue #9979 : Use PyUnicode_AsWideCharString() in import.c
...
Don't truncate path if it is too long anymore, and allocate fewer memory (but
allocate it on the heap, not on the stack).
2010-09-29 10:28:51 +00:00
Brett Cannon
5305a998d5
Since __import__ is not designed for general use, have its docstring point
...
people towards importlib.import_module().
Closes issue #7397 .
2010-09-27 21:08:38 +00:00
Benjamin Peterson
aa7fbd9564
revert r85003, poorly considered; breaks tests
2010-09-25 03:25:42 +00:00
Benjamin Peterson
81437c9025
don't count keyword arguments as positional #9943
2010-09-25 03:14:33 +00:00
Benjamin Peterson
d4efd9eb15
add column offset to all syntax errors
2010-09-20 23:02:10 +00:00
Benjamin Peterson
2c53971b37
add PyErr_SyntaxLocationEx, to support adding a column offset
2010-09-20 22:42:10 +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
Kristján Valur Jónsson
2fea9b961d
issue 9786 Native TLS support for pthreads
...
PyThread_create_key now has a failure mode that the applicatino can detect.
2010-09-20 02:11:49 +00:00
Brett Cannon
bc2eff3112
PyImport_Import was using the old import hack of sticking a dummy value into
...
fromlist to get __import__ to return the module desired. Now it uses the proper
approach of fetching the module from sys.modules.
Closes issue #9252 . Thanks to Alexander Belopolsky for the bug report.
2010-09-19 21:39:02 +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
Nick Coghlan
cd419abe42
Fix incorrect comment regarding MAGIC and TAG in import.c
2010-09-11 00:39:25 +00:00
Benjamin Peterson
e208b7c5b1
typo
2010-09-10 23:53:14 +00:00
Benjamin Peterson
d0de25d731
use Py_REFCNT
2010-09-10 23:52:42 +00:00
Benjamin Peterson
d2be5b4fe4
remove gil_drop_request in --without-threads
2010-09-10 22:47:02 +00:00
Benjamin Peterson
00ebe2cdc4
use DISPATCH() instead of continue
2010-09-10 22:02:31 +00:00
Victor Stinner
5b519e0201
Issue #9632 : Remove sys.setfilesystemencoding() function: use PYTHONFSENCODING
...
environment variable to set the filesystem encoding at Python startup.
sys.setfilesystemencoding() creates inconsistencies because it is unable to
reencode all filenames in all objects.
2010-09-10 21:57:59 +00:00
Benjamin Peterson
6246d6dcb0
bump magic number for DELETE_DEREF
2010-09-10 21:51:44 +00:00
Amaury Forgeot d'Arc
ba117ef7e9
#4617 : Previously it was illegal to delete a name from the local
...
namespace if it occurs as a free variable in a nested block. This limitation
of the compiler has been lifted, and a new opcode introduced (DELETE_DEREF).
This sample was valid in 2.6, but fails to compile in 3.x without this change::
>>> def f():
... def print_error():
... print(e)
... try:
... something
... except Exception as e:
... print_error()
... # implicit "del e" here
This sample has always been invalid in Python, and now works::
>>> def outer(x):
... def inner():
... return x
... inner()
... del x
There is no need to bump the PYC magic number: the new opcode is used
for code that did not compile before.
2010-09-10 21:39:53 +00:00
Daniel Stutzbach
c7937791a1
Fix Issue #9752 : MSVC compiler warning due to undefined function
...
(Patch by Jon Anglin)
2010-09-09 21:18:04 +00:00
Antoine Pitrou
c9a8df24cc
Merged revisions 84655 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84655 | antoine.pitrou | 2010-09-09 22:30:23 +0200 (jeu., 09 sept. 2010) | 6 lines
Issue #9804 : ascii() now always represents unicode surrogate pairs as
a single `\UXXXXXXXX`, regardless of whether the character is printable
or not. Also, the "backslashreplace" error handler now joins surrogate
pairs into a single character on UCS-2 builds.
........
2010-09-09 20:33:43 +00:00
Antoine Pitrou
e4a189274f
Issue #9804 : ascii() now always represents unicode surrogate pairs as
...
a single `\UXXXXXXXX`, regardless of whether the character is printable
or not. Also, the "backslashreplace" error handler now joins surrogate
pairs into a single character on UCS-2 builds.
2010-09-09 20:30:23 +00:00
Matthias Klose
f69af1e959
PEP 3149: Try to load the extension with the SOABI before trying
...
to load the one without the SOABI in the name.
2010-09-08 16:22:10 +00:00
Antoine Pitrou
3c6261a90b
Merged revisions 84623 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84623 | antoine.pitrou | 2010-09-08 14:37:10 +0200 (mer., 08 sept. 2010) | 4 lines
Issue #9797 : pystate.c wrongly assumed that zero couldn't be a valid
thread-local storage key.
........
2010-09-08 12:48:12 +00:00
Antoine Pitrou
079ce54efe
Issue #9797 : pystate.c wrongly assumed that zero couldn't be a valid
...
thread-local storage key.
2010-09-08 12:37:10 +00:00
Antoine Pitrou
74a69fa662
Issue #9225 : Remove the ROT_FOUR and DUP_TOPX opcode, the latter replaced
...
by the new (and simpler) DUP_TOP_TWO. Performance isn't changed, but
our bytecode is a bit simplified. Patch by Demur Rumed.
2010-09-04 18:43:52 +00:00
Brett Cannon
ef0e6c3b04
_warnings exposed two variables with the name 'default_action' and
...
'once_registry'. This is bad as the warnings module had variables named
'defaultaction' and 'onceregistry' which are what people should be looking at
(technically those variables shouldn't be mucked with as they are undocumented,
but we all know better than to believe that isn't happening). So the variables
from _warnings have been renamed to come off as private and to avoid confusion
over what variable should be used.
Closes issue #9766 . Thanks to Antoine Pitrou for the discovery.
2010-09-04 18:24:04 +00:00
Barry Warsaw
35f3a2cbeb
PEP 3149 is accepted.
...
http://mail.python.org/pipermail/python-dev/2010-September/103408.html
2010-09-03 18:30:30 +00:00
Antoine Pitrou
fce7fd6426
Issue #9549 : sys.setdefaultencoding() and PyUnicode_SetDefaultEncoding()
...
are now removed, since their effect was inexistent in 3.x (the default
encoding is hardcoded to utf-8 and cannot be changed).
2010-09-01 18:54:56 +00:00
Benjamin Peterson
17689991e6
only catch AttributeError in hasattr() #9666
2010-08-24 03:26:23 +00:00
Raymond Hettinger
819a064556
Issue 8403: Don't mask KeyboardInterrupt during peephole operation.
2010-08-22 08:39:49 +00:00
Amaury Forgeot d'Arc
a1e5c69d5b
Merged revisions 84214 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84214 | amaury.forgeotdarc | 2010-08-19 23:32:38 +0200 (jeu., 19 août 2010) | 3 lines
Add tests for r84209 (crashes in the Ast builder)
Also remove one tab, and move a check closer to the possible failure.
........
2010-08-19 21:35:59 +00:00
Amaury Forgeot d'Arc
12844e6df6
Add tests for r84209 (crashes in the Ast builder)
...
Also remove one tab, and move a check closer to the possible failure.
2010-08-19 21:32:38 +00:00
Amaury Forgeot d'Arc
fc34ac5fdd
Merged revisions 84209 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84209 | amaury.forgeotdarc | 2010-08-19 19:43:15 +0200 (jeu., 19 août 2010) | 5 lines
Check the return values for all functions returning an ast node.
Failure to do it may result in strange error messages or even crashes,
in admittedly convoluted cases that are normally syntax errors, like:
def f(*xx, __debug__): pass
........
2010-08-19 20:26:00 +00:00
Amaury Forgeot d'Arc
92dc80a8d8
Check the return values for all functions returning an ast node.
...
Failure to do it may result in strange error messages or even crashes,
in admittedly convoluted cases that are normally syntax errors, like:
def f(*xx, __debug__): pass
2010-08-19 17:43:15 +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
6b06da5395
Remove unused functions _PyImport_FindModule and _PyImport_IsScript
2010-08-17 22:54:21 +00:00
Victor Stinner
6961bd690e
Issue #8063 : Call _PyGILState_Init() earlier in Py_InitializeEx().
2010-08-17 22:26:51 +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
4a3733d160
Issue #9425 : save/restore exception on filename encoding
...
_PyUnicode_AsString() raises an exception on unencodable filename.
2010-08-17 00:39:57 +00:00
Florent Xicluna
2760a66b69
Merged revisions 81214,82302,82465,83090-83091,84097,84099 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81214 | brett.cannon | 2010-05-16 00:20:16 +0200 (dim., 16 mai 2010) | 2 lines
A test was not guaranteeing cleanup in the face of an exception.
................
r82302 | benjamin.peterson | 2010-06-28 00:37:28 +0200 (lun., 28 juin 2010) | 15 lines
Merged revisions 81380 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81380 | brett.cannon | 2010-05-20 13:37:55 -0500 (Thu, 20 May 2010) | 8 lines
Turned out that if you used explicit relative import syntax
(e.g. from .os import sep) and it failed, import would still try the implicit
relative import semantics of an absolute import (from os import sep). That's
not right, so when level is negative, only do explicit relative import
semantics.
Fixes issue #7902 . Thanks to Meador Inge for the patch.
........
................
r82465 | brett.cannon | 2010-07-03 03:32:48 +0200 (sam., 03 juil. 2010) | 3 lines
Make test_import a little bit more robust for cleaning up after itself in the
face of a failure.
................
r83090 | brett.cannon | 2010-07-23 16:03:16 +0200 (ven., 23 juil. 2010) | 4 lines
Explicitly test relative imports by reusing importlib tests.
Closes issue 8392. Thanks Virgil Dupras for the initial patch.
................
r83091 | brett.cannon | 2010-07-23 16:45:19 +0200 (ven., 23 juil. 2010) | 1 line
Stop shadowing a test class.
................
r84097 | florent.xicluna | 2010-08-16 20:41:19 +0200 (lun., 16 août 2010) | 1 line
Use test.support and unittest features. Fix duplicated test (bad merge in r79033). Fix comment for issue #7902 .
................
r84099 | florent.xicluna | 2010-08-16 21:03:05 +0200 (lun., 16 août 2010) | 1 line
I get it wrong in r84097: s/relative/absolute/
................
2010-08-16 22:40:45 +00:00
Victor Stinner
79766636b6
Issue #9599 : Create PySys_FormatStdout() and PySys_FormatStderr()
...
Write a message formatted by PyUnicode_FromFormatV() to sys.stdout and
sys.stderr.
2010-08-16 17:36:42 +00:00
Victor Stinner
f52b705be4
Create _Py_fopen() for PyUnicodeObject path
...
Call _wfopen() on Windows, or fopen() otherwise. Return the new file object on
success, or NULL if the file cannot be open or (if PyErr_Occurred()) on unicode
error.
2010-08-14 17:06:04 +00:00
Victor Stinner
8a79dccc48
_Py_stat(): ensure that path ends with a nul character
2010-08-14 16:59:08 +00:00
Victor Stinner
4f4402c4bb
Issue #9425 : Create private _Py_stat() function
...
Use stat() or _wstat() depending on the OS.
2010-08-14 14:50:26 +00:00
Antoine Pitrou
042b128f58
Issue #9203 : Computed gotos are now enabled by default on supported
...
compilers (which are detected by the configure script). They can still
be disable selectively by specifying --without-computed-gotos.
2010-08-13 21:15:58 +00:00
Victor Stinner
4a2b7a1b14
Issue #9425 : Create PyErr_WarnFormat() function
...
Similar to PyErr_WarnEx() but use PyUnicode_FromFormatV() to format the warning
message.
Strip also some trailing spaces.
2010-08-13 14:03:48 +00:00
Victor Stinner
1a4d12d746
Issue #9425 : NullImporter constructor is fully unicode compliant
...
* On non-Windows OSes: the constructor accepts bytes filenames
and use surrogateescape for unicode filenames
* On Windows: use GetFileAttributesW() instead of GetFileAttributesA()
2010-08-13 13:07:29 +00:00
Alexander Belopolsky
f0f45142d5
Issue #2443 : Added a new macro, Py_VA_COPY, which is equivalent to C99
...
va_copy, but available on all python platforms. Untabified a few
unrelated files.
2010-08-11 17:31:17 +00:00