Commit Graph

3408 Commits

Author SHA1 Message Date
Victor Stinner 6ced7c4333 Issue #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead of
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
2011-03-21 18:15:42 +01:00
Victor Stinner 451385d8f8 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 bytes).
2011-03-21 03:22:50 +01:00
Victor Stinner 9c4efe571d Fix #11586: typo in initfsencoding()
Patch written by Ray Allen.
2011-03-20 23:23:22 +01:00
Victor Stinner 4ca2809b5c Fix #11586: typo in initfsencoding()
Patch written by Ray Allen.
2011-03-20 23:09:03 +01:00
Victor Stinner 6ae1e7f04e Issue #3080: imp.load_module() accepts None for the module path
imp.find_module() returns None as module path for builtin and frozen builtins.
2011-03-20 22:37:17 +01:00
Victor Stinner cc9564ecd8 Issue #3080: Fix call to case_ok() in find_init_module() 2011-03-20 04:58:29 +01:00
Victor Stinner 1304f2d8a3 Issue #3080: Fix case_ok() using case_bytes()
Invert name and namelen arguments.
2011-03-20 04:28:55 +01:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
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