Commit Graph

3607 Commits

Author SHA1 Message Date
Martin v. Löwis f45dee998f Port import_module_level to Unicode API. 2011-10-30 23:50:02 +01:00
Antoine Pitrou 6fbbc33440 Issue #10363: Deallocate global locks in Py_Finalize(). 2011-10-30 19:14:46 +01:00
Martin v. Löwis 796ea53937 Port PyImport_ReloadModule to Unicode API. 2011-10-30 09:07:07 +01:00
Florent Xicluna 908ae24b06 Merge 3.2 (linked to issue #1294232) 2011-10-28 15:06:13 +02:00
Antoine Pitrou b528fcf954 Fix test_imp failure under Windows 2011-10-25 00:21:02 +02:00
Martin v. Löwis 9af29d39af Rewrite find_module_path using unicode API. 2011-10-23 18:45:16 +02:00
Martin v. Löwis 2cc0cc54a2 Fix off-by-one error. 2011-10-23 18:41:56 +02:00
Martin v. Löwis fadcd317fa Drop unused macros. Use CACHEDIR consistently. 2011-10-23 18:08:20 +02:00
Martin v. Löwis 8a0ef78e8c Rewrite make_source_pathname using Unicode API. 2011-10-23 18:05:06 +02:00
Martin v. Löwis 30260a7fe3 Add ready checks for make_compiled_pathname. 2011-10-23 17:35:46 +02:00
Martin v. Löwis 2db72863fb Reformulate make_compiled_pathname in terms of unicode objects. 2011-10-23 17:29:08 +02:00
Nick Coghlan 9715d26305 Merge issue 1294232 patch from 3.2 2011-10-23 22:36:42 +10:00
Victor Stinner 3a50e7056e Issue #12281: Rewrite the MBCS codec to handle correctly replace and ignore
error handlers on all Windows versions. The MBCS codec is now supporting all
error handlers, instead of only replace to encode and ignore to decode.
2011-10-18 21:21:00 +02:00
Victor Stinner 9ea8e4c29d Instantiate the OS-related exception as soon as we raise it, so that "except"
works properly.

PyErr_SetFromErrnoWithFilenameObject() was already fixed by the changeset
793c75177d28. This commit fixes PyErr_SetExcFromWindowsErrWithFilenameObject(),
used on Windows.
2011-10-17 20:18:58 +02:00
Antoine Pitrou 707033a694 Issue #13146: Writing a pyc file is now atomic under POSIX. 2011-10-17 19:28:44 +02:00
Martin v. Löwis 1c67dd9b15 Port SetAttrString/HasAttrString to SetAttrId/GetAttrId. 2011-10-14 15:16:45 +02:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Victor Stinner f5cff56a1b Issue #13088: Add shared Py_hexdigits constant to format a number into base 16 2011-10-14 02:13:11 +02:00
Victor Stinner 9d663d0788 convertsimple(): "str without bytes" => "str without characters" 2011-10-13 23:25:03 +02:00
Antoine Pitrou 5d6fbe8207 Instantiate the OS-related exception as soon as we raise it, so that
"except" works properly.
2011-10-12 19:39:57 +02:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00
Victor Stinner 8c9818980b Fix typo in import.c 2011-10-11 22:27:13 +02:00
Victor Stinner c4f281eba3 Fix misuse of PyUnicode_GET_SIZE, use PyUnicode_GET_LENGTH instead 2011-10-11 22:11:42 +02:00
Victor Stinner beac78bb24 Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE() 2011-10-11 21:55:01 +02:00
Martin v. Löwis 1ee1b6fe0d Use identifier API for PyObject_GetAttrString. 2011-10-10 18:11:30 +02:00
Martin v. Löwis afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Martin v. Löwis c47adb04b3 Change PyUnicode_KIND to 1,2,4. Drop _KIND_SIZE and _CHARACTER_SIZE. 2011-10-07 20:55:35 +02:00
Victor Stinner 46084bad88 Fix find_module_path(): make the string ready 2011-10-06 02:39:42 +02:00
Victor Stinner b62a7b268a Fix _warnings.c: make the filename string ready 2011-10-06 02:34:51 +02:00
Victor Stinner fb9ea8c57e Don't check for the maximum character when copying from unicodeobject.c
* Create copy_characters() function which doesn't check for the maximum
   character in release mode
 * _PyUnicode_CheckConsistency() is no more static to be able to use it
   in _PyUnicode_FormatAdvanced() (in formatter_unicode.c)
 * _PyUnicode_CheckConsistency() checks the string hash
2011-10-06 01:45:57 +02:00
Victor Stinner a336de7ae1 traceback: fix dump_ascii() for string with kind=PyUnicode_WCHAR_KIND 2011-10-05 22:44:12 +02:00
Victor Stinner c3cec7868b Add asciilib: similar to ucs1, ucs2 and ucs4 library, but specialized to ASCII
ucs1, ucs2 and ucs4 libraries have to scan created substring to find the
maximum character, whereas it is not need to ASCII strings. Because ASCII
strings are common, it is useful to optimize ASCII.
2011-10-05 21:24:08 +02:00
Victor Stinner e1335c711c Fix usage og PyUnicode_READY() 2011-10-04 20:53:03 +02:00
Victor Stinner d2a915dbf6 ceval.c: restore str+=str optimization 2011-10-02 20:34:20 +02:00
Victor Stinner 67002af323 Check error when calling PyUnicode_AppendAndDel() 2011-10-02 20:35:10 +02:00
Victor Stinner 1a15aba71d PyCodec_ReplaceErrors() uses "C" format instead of "u#" to build result 2011-10-02 19:00:15 +02:00
Benjamin Peterson 014cc42db8 remove unused label 2011-10-02 13:19:16 -04:00
Martin v. Löwis 0b1d348990 Issue 13085: Fix some memory leaks. Patch by Stefan Krah. 2011-10-01 16:35:40 +02:00
Benjamin Peterson 811c2f1369 remove "fast-path" for (i)adding strings
These were just an artifact of the old unicode concatenation hack and likely
just penalized other kinds of adding. Also, this fixes __(i)add__ on string
subclasses.
2011-09-30 21:31:21 -04:00
Victor Stinner bec0fda264 Remove commented code: str+=str is no more super-optimized 2011-10-01 01:26:08 +02:00
Victor Stinner d9c563e84d modsupport.c reuses Py_UNICODE_strlen() 2011-09-29 04:01:43 +02:00
Victor Stinner 639418812f Use the new Py_ARRAY_LENGTH macro 2011-09-29 00:42:28 +02:00
Ezio Melotti 48a2f8fd97 #13054: sys.maxunicode is now always 0x10FFFF. 2011-09-29 00:18:19 +03:00
Victor Stinner fd85c3aa8d fill_number() and format_string_internal() check for PyUnicode_CopyCharacters() failure 2011-09-28 21:53:49 +02:00
Victor Stinner dba2deeca2 fill_number() ensures that the 'digits' string is ready 2011-09-28 21:50:42 +02:00
Victor Stinner afbaa20fb9 fill_char() can now propagate an error 2011-09-28 21:50:16 +02:00
Victor Stinner 6c7a52a46f Check for PyUnicode_CopyCharacters() failure 2011-09-28 21:39:17 +02:00
Georg Brandl 4cb0de246c Rename new macros to conform to naming rules (function macros have "Py" prefix, not "PY"). 2011-09-28 21:49:49 +02:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Victor Stinner a1fe1f8dcf Merge 3.2: Issue #7732: Don't open a directory as a file anymore while
importing a module. Ignore the direcotry if its name matchs the module name
(e.g.  "__init__.py") and raise a ImportError instead.
2011-09-23 18:59:08 +02:00
Victor Stinner 53ffdc53bf Issue #7732: Don't open a directory as a file anymore while importing a
module. Ignore the direcotry if its name matchs the module name (e.g.
"__init__.py") and raise a ImportError instead.
2011-09-23 18:54:40 +02:00
Stefan Krah 472d280d8b Issue #13002: Fix Visual Studio warning (not enough actual parameters). 2011-09-21 19:08:39 +02:00
Barry Warsaw a80b14cc5f - Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
finding the bug and providing a patch.
2011-09-20 14:58:01 -04:00
Barry Warsaw 916048d780 - Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
finding the bug and providing a patch.
2011-09-20 14:45:44 -04:00
Victor Stinner 9561d7c526 import.c: remove now useless arbitrary limit 2011-09-15 19:50:01 +02:00
Victor Stinner 84b8e40fd7 Merge 3.2: Fix the import machinery if there is an error on sys.path or sys.meta_path
find_module() now raises a RuntimeError, instead of ImportError, on an error on
sys.path or sys.meta_path because load_package() and import_submodule() returns
None and clear the exception if a ImportError occurred.
2011-09-15 19:38:54 +02:00
Victor Stinner 1619132e5d Fix the import machinery if there is an error on sys.path or sys.meta_path
find_module() now raises a RuntimeError, instead of ImportError, on an error on
sys.path or sys.meta_path because load_package() and import_submodule() returns
None and clear the exception if a ImportError occurred.
2011-09-15 19:28:05 +02:00
Éric Araujo 6f08f53e79 Merge 3.2 2011-09-02 17:32:30 +02:00
Victor Stinner 22d80bcf1b Merge 3.2: Remove unused variable if Python is build without threads 2011-09-02 00:13:16 +02:00
Victor Stinner 0af0306396 Remove unused variable if Python is build without threads 2011-09-02 00:11:43 +02:00
Benjamin Peterson 0224d4e699 accept bytes for the AST 'string' type
This is a temporary kludge and all is well in 3.3.
2011-08-31 22:13:03 -04:00
Benjamin Peterson ea281a54f3 include header with PyAST_Validate 2011-08-12 23:10:50 -05:00
Benjamin Peterson 832bfe2ebd add a AST validator (closes #12575) 2011-08-09 16:15:04 -05:00
Benjamin Peterson e249841903 add a asdl bytes type, so Bytes.s be properly typechecked 2011-08-09 16:08:39 -05:00
Benjamin Peterson 405f32c14c plug refleak 2011-07-29 22:43:45 -05:00
Benjamin Peterson 4f921c2e06 bytes -> bytearray 2011-07-29 14:24:29 -05:00
Benjamin Peterson ce071ca4e7 bytes should be verboten in sum() (fixes #12654) 2011-07-29 14:23:47 -05:00
Éric Araujo 0bbacc621c Branch merge 2011-07-29 14:30:03 +02:00
Eli Bendersky 906b88fb2a Issue #12380: PyArg_ParseTuple now accepts a bytearray for the 'c' format.
As a side effect, this now allows the rjust, ljust and center methods of
bytes and bytearray to accept a bytearray argument.

Patch by Petri Lehtinen
2011-07-29 07:05:08 +03:00
Éric Araujo 2527796a22 Merge from 3.2 (#10318, #12255, #12043, #12417 and other fixes) 2011-07-29 03:11:09 +02:00
Éric Araujo 6c0ba447bd Fix style in code added by edba722f3b02 2011-07-26 17:23:57 +02:00
Antoine Pitrou 5a24d82941 Add a test for issue #1813: getlocale() failing under a Turkish locale
(not a problem under 3.x)
2011-07-24 02:41:54 +02:00
Antoine Pitrou cf9d3c08c8 Issue #1813: Fix codec lookup under Turkish locales. 2011-07-24 02:27:04 +02:00
Charles-François Natali f23339a7bb Issue 12620: Make pendingbusy flag static to Py_MakePendingCalls(). 2011-07-23 18:15:43 +02:00
Benjamin Peterson 8a4b42b7f4 merge 3.2 2011-07-22 11:10:43 -05:00
Benjamin Peterson 180e63507d None is ok for identifiers but not strings 2011-07-22 11:09:07 -05:00
Benjamin Peterson 86f088e8e5 merge 3.2 2011-07-22 10:55:02 -05:00
Benjamin Peterson 2193d2b72b type check AST strings and identifiers
This is related to a21829180423 as well as #12609 and #12610.
2011-07-22 10:50:23 -05:00
Benjamin Peterson efad2449fc hardcode the old svn __version__ 2011-07-22 10:39:12 -05:00
Benjamin Peterson bd9c655c97 merge heads 2011-07-17 22:50:12 -05:00
Benjamin Peterson 76f7f4d979 excise the remains of STOP_CODE, which hasn't done anything useful for years 2011-07-17 22:49:50 -05:00
Brett Cannon 52a7d98273 Make warnings accept a callable for showwarnings instead of
restricting itself to just functions and methods (which allows
built-in functions to be used, etc.).

Closes issue #10271. Thanks to lekma for the bug report.
2011-07-17 19:17:55 -07:00
Benjamin Peterson 0bd152cd67 remove ast.__version__ (closes #12273) 2011-07-15 21:10:13 -05:00
Benjamin Peterson e92cd0ce98 merge 3.2 (#11627) 2011-07-15 14:10:35 -05:00
Benjamin Peterson 5afa03a72e catch nasty exception classes with __new__ that doesn't return a exception (closes #11627)
Patch from Andreas Stührk.
2011-07-15 14:09:26 -05:00
Victor Stinner ecf4fdad50 Py_BuildValue("C") supports non-BMP characters on narrow build
Py_BuildValue("C") doesn't have to check the code point,
PyUnicode_FromOrdinal() checks its input and now supports non-BMP characters
(range U+10000-U+10FFFF).
2011-07-15 01:13:24 +02:00
Antoine Pitrou 370092071b Issue #11863: Remove support for legacy systems deprecated in Python 3.2
(following PEP 11).  These systems are systems using Mach C Threads,
SunOS lightweight processes, GNU pth threads and IRIX threads.
2011-07-08 23:47:50 +02:00
Antoine Pitrou 022ae22cc6 Issue #11863: remove unused file Python/thread_wince.h 2011-07-08 23:37:39 +02:00
Benjamin Peterson 9797e29f86 merge 3.2 2011-07-04 22:28:00 -05:00
Benjamin Peterson bb4a747b69 start out this branch always with filename NULL 2011-07-04 22:27:16 -05:00
Victor Stinner 87e78ce1c6 Issue #12469: partial revert of 024827a9db64, freebsd6 thread initialization
* Don't create a thread at startup anymore to initialize the pthread library:
   it changes the behaviour of many functions related to signal handling like
   sigwait()
 * Reenable test_sigtimedwait_poll() on FreeBSD 6
2011-07-04 22:53:49 +02:00
Victor Stinner 99b9538636 Issue #9642: Uniformize the tests on the availability of the mbcs codec
Add a new HAVE_MBCS define.
2011-07-04 14:23:54 +02:00
Victor Stinner d64e8a75e5 Issue #9642: Fix filesystem encoding initialization: use the ANSI code page on
Windows if the mbcs codec is not available, and fail with a fatal error if we
cannot get the locale encoding (if nl_langinfo(CODESET) is not available)
instead of using UTF-8.
2011-07-04 13:48:30 +02:00
Benjamin Peterson 401d197657 merge 3.2 2011-07-03 22:19:29 -05:00
Benjamin Peterson a55007a620 plug refleak 2011-07-03 22:18:34 -05:00
Victor Stinner 5a21e83119 (merge 3.2) Issue #12467: warnings: fix a race condition if a warning is
emitted at shutdown, if globals()['__file__'] is None.
2011-07-04 02:56:10 +02:00
Victor Stinner 8b0508ed4e Issue #12467: warnings: fix a race condition if a warning is emitted at
shutdown, if globals()['__file__'] is None.
2011-07-04 02:43:09 +02:00
Benjamin Peterson 9bfd0dee9b no one passes NULL here (or should anyway) 2011-07-03 17:06:32 -05:00
Benjamin Peterson 878802435d convert generator exc state functions into static functions 2011-07-03 16:48:31 -05:00
Benjamin Peterson 536feac7f8 merge 3.2 2011-07-03 16:27:41 -05:00