Commit Graph

3496 Commits

Author SHA1 Message Date
Benjamin Peterson 9003760991 map cells to arg slots at code creation time (closes #12399)
This removes nested loops in PyEval_EvalCodeEx.
2011-06-25 22:54:45 -05:00
Victor Stinner e71db4450c Issue #12392: fix thread initialization on FreeBSD 6
On FreeBSD6, pthread_kill() doesn't work on the main thread before the creation
of the first thread. Create therefore a dummy thread (no-op) a startup to
initialize the pthread library.

Add also a test for this use case, test written by Charles-François Natali.
2011-06-24 20:52:27 +02:00
Benjamin Peterson e109c70860 give the names of missing positional or keyword-only arguments (closes #12356) 2011-06-24 09:37:26 -05:00
Benjamin Peterson 28db0fd357 merge 3.2 2011-06-20 22:09:20 -05:00
Benjamin Peterson b7149cad04 fix indentation 2011-06-20 22:09:13 -05:00
Benjamin Peterson 267ca6cb23 merge 3.2 2011-06-20 21:40:46 -05:00
Benjamin Peterson f63d615f8b fix indentation 2011-06-20 21:40:19 -05:00
Victor Stinner d417d01ec8 call_find_module() handles dup() failure: raise an OSError exception 2011-06-20 15:16:55 +02:00
Victor Stinner 925ef39949 find_module_path_list() fails if _Py_fopen() failed and raised an exception
(UnicodeEncodeError).
2011-06-20 15:01:10 +02:00
Benjamin Peterson e7c15fa184 bump magic for super closure change 2011-06-19 19:54:45 -05:00
Benjamin Peterson f5ff22329b use a invalid name for the __class__ closure for super() (closes #12370)
This prevents the assignment of __class__ in the class body from breaking
super. (Although a determined person could do locals()["@__class__"] = 4)
2011-06-19 19:42:22 -05:00
Brian Curtin 589f89e2ad Removed a Windows 9x trick used before LoadLibraryExW.
Windows 9x has long been unsupported and the result of GetFullPathName
was not even being used in the first place.
2011-06-09 17:55:54 -05:00
Benjamin Peterson b204a42383 greatly improve argument parsing error messages (closes #12265) 2011-06-05 22:04:07 -05:00
Benjamin Peterson 48deae12d5 some horrible preprocessing tricks to automatically update the tag 2011-06-03 17:50:16 -05:00
Vinay Sajip 623e8b86af Removed some unused local variables. 2011-07-02 17:21:37 +01:00
Benjamin Peterson 04a90b4611 bump ast version 2011-05-29 11:45:29 -05:00
Benjamin Peterson 43af12b0b4 unify TryExcept and TryFinally (closes #12199) 2011-05-29 11:43:10 -05:00
Ned Deily 61be422bd7 Issue #9670: Increase the default stack size for secondary threads on
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(patch by Ronald Oussoren)
2011-05-28 00:45:52 -07:00
Ned Deily 056f5b9dad Issue #9670: Increase the default stack size for secondary threads on
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(patch by Ronald Oussoren)
2011-05-28 00:36:12 -07:00
Ned Deily 9a7c524dc6 Issue #9670: Increase the default stack size for secondary threads on
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(patch by Ronald Oussoren)
2011-05-28 00:19:56 -07:00
Benjamin Peterson d8255e0e9e merge 3.2 2011-05-27 14:17:35 -05:00
Benjamin Peterson a290bac5b1 merge 3.1 2011-05-27 14:17:19 -05:00
Benjamin Peterson 0a5dad9ef1 fix spacing 2011-05-27 14:17:04 -05:00
Benjamin Peterson 4a0f20f5a3 merge 3.2 2011-05-27 14:12:53 -05:00
Benjamin Peterson 5218853c67 merge 3.1 2011-05-27 14:10:36 -05:00
Benjamin Peterson 74897ba46f fix indentation 2011-05-27 14:10:24 -05:00
Benjamin Peterson 7f670e5dad bump ast version 2011-05-27 14:01:01 -05:00
Benjamin Peterson bf1bbc1452 reflect with statements with multiple items in the AST (closes #12106) 2011-05-27 13:58:08 -05:00
Victor Stinner 4f2dab5c33 Revert my commit 7ba176c2f558: "Avoid useless "++" at the end of functions
Warnings found by the Clang Static Analyzer."

Most people prefer ++ at the end of functions.
2011-05-27 16:46:51 +02:00
Benjamin Peterson 43b068648e try to use the same str object for all code filenames when compiling or unmarshalling (#12190)
This should reduce memory usage.
2011-05-27 09:08:01 -05:00
Benjamin Peterson d408503b2c remove unused string WILFE attribute 2011-05-27 07:53:28 -05:00
Victor Stinner 13b21bd749 print_exception(): handle correctly PyObject_GetAttrString() failure
Bug found by the Clang Static Analyzer.
2011-05-26 14:25:13 +02:00
Victor Stinner 97e561ef24 Avoid useless "++" at the end of functions
Warnings found by the Clang Static Analyzer.
2011-05-26 13:53:47 +02:00
Victor Stinner 25095b2be6 Remove useless assignments
Warnings found by the the Clang Static Analyzer.
2011-05-26 13:47:08 +02:00
Benjamin Peterson 04778a8150 make PyImport_ImportModuleLevel's first arg const like similiar functions (closes #12173) 2011-05-25 09:29:00 -05:00
Victor Stinner 118ed71afe (Merge 3.2) Issue #11614: import __hello__ prints "Hello World!". Patch written
by Andreas Stührk.
2011-05-16 16:35:35 +02:00
Victor Stinner 9cd6626f3d (Merge 3.1) Issue #11614: import __hello__ prints "Hello World!". Patch written
by Andreas Stührk.
2011-05-16 16:32:33 +02:00
Victor Stinner c77b931196 Issue #11614: import __hello__ prints "Hello World!". Patch written by Andreas
Stührk.
2011-05-16 16:29:35 +02:00
Georg Brandl 1a4de20d95 Merge #6498 fix from 3.2. 2011-05-15 08:49:38 +02:00
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
Victor Stinner 65b7eff7c7 _PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
The name must be encodable to ASCII because dynamic module must have a function
called "PyInit_NAME", they are written in C, and the C language doesn't accept
non-ASCII identifiers.
2011-05-07 12:46:05 +02:00
Victor Stinner 7bba62fd68 faulthandler: dump all threads by default
* Set the default value of all_threads arguments to True
 * Py_FatalError() dumps all threads, instead of only the current thread

Dump only the current thread is not reliable. In some cases, Python is unable
to retrieve the state of the current thread and so is unable to dump the
traceback. faulthandler keeps a reference to the interpreter and so is always
able to dump the traceback of all threads.
2011-05-07 12:43:00 +02:00
Antoine Pitrou fc20b0c65c 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:04:29 +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 d5c355ccc7 Issue #11223: Replace threading._info() by sys.thread_info 2011-04-30 14:53:09 +02:00
Antoine Pitrou 9ea1c8d7d7 Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_*
APIs, to avoid a crash with the pthread implementation in RHEL 5.  Patch
by Charles-François Natali.
2011-04-27 19:30:16 +02:00
Antoine Pitrou 0c759febb6 Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_*
APIs, to avoid a crash with the pthread implementation in RHEL 5.  Patch
by Charles-François Natali.
2011-04-27 19:28:05 +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 793b531756 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 c40a350db0 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
Jesus Cea 7124f5f7e8 MERGE: Up-port changeset 5cf8f6da8743 (closes #11890) 2011-04-20 20:32:52 +02:00
Jesus Cea 1d4ae84e53 Up-port changeset 5cf8f6da8743 (closes #11890) 2011-04-20 20:24:57 +02:00
Victor Stinner e07f522c7f Issue #11223: fix compiler warnings 2011-04-20 12:23:26 +02:00
Victor Stinner 783c82c701 Close #11619: write_compiled_module() doesn't encode the filename
Reimplement open_exclusive() using _wopen() to avoid encoding the filename to
the filesystem encoding: use the Unicode version of the Windows API.
2011-04-20 03:27:51 +02:00
Victor Stinner 754851f456 Issue #11223: Add threading._info() function providing informations about the
thread implementation.

Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of
test_threadsignals if a thread lock is implemented using a POSIX mutex and a
POSIX condition variable. A POSIX condition variable cannot be interrupted by a
signal (e.g. on Linux, the futex system call is restarted).
2011-04-19 23:58:51 +02:00
Ezio Melotti e1adeeb7fd #5057: Merge with 3.2. 2011-04-15 16:52:35 +03:00
Ezio Melotti 71e84a6e27 #5057: Merge with 3.1. 2011-04-15 16:50:41 +03:00
Ezio Melotti 2df6a93916 Issue #5057: fix a bug in the peepholer that led to non-portable pyc files between narrow and wide builds while optimizing BINARY_SUBSCR on non-BMP chars (e.g. "\U00012345"[0]). 2011-04-15 16:38:34 +03:00
Benjamin Peterson 59c90c6cb2 merge 3.2 2011-04-12 18:35:21 -05:00
Benjamin Peterson 62f8bcb0a4 merge 3.1 2011-04-12 18:34:30 -05:00
Benjamin Peterson bd3e362089 make assigning to a bytes literal a syntax error (closes #11506) 2011-04-12 18:33:28 -05:00
Eli Bendersky dd97fbb2dc Issue #9904: fix and clarify some comments + fix indentation in symtable code 2011-04-10 07:37:26 +03:00
Ned Deily 4e6aba6f63 Issue9670: Merge backout from 3.2. 2011-04-09 14:58:04 -07:00
Ned Deily 2604e33f30 Issue9670: Merge backout to 3.2. 2011-04-09 14:53:47 -07:00
Ned Deily 45e47e58ed Issue9670: Back out changeset 378b40d71175; test fails on other platforms
and on OS X with pydebug.
2011-04-09 14:50:59 -07:00
Ned Deily 6e678b4395 Issue #9670: merge with current 2011-04-09 12:47:12 -07:00
Ned Deily 15012a67d2 Issue #9670: merge with 3.2 2011-04-09 12:37:55 -07:00
Ned Deily 517ac72b00 Issue #9670: Increase the default stack size for secondary threads on
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
"maximum recursion depth" RuntimeError exception.
(Patch by Ronald Oussoren)
2011-04-09 12:32:12 -07:00
Alexander Belopolsky 0df80926c9 Removed 'or long integer' from bin, oct, and hex docstrings. 2011-04-07 00:16:22 -04:00
Alexander Belopolsky 12338ab10b Removed 'or long integer' from bin, oct, and hex docstrings. 2011-04-07 00:15:33 -04:00
Victor Stinner fe7c5b5bdf Issue #9319: Include the filename in "Non-UTF8 code ..." syntax error. 2011-04-05 01:48:03 +02:00
Victor Stinner 7f2fee3640 Issue #10785: Store the filename as Unicode in the Python parser. 2011-04-05 00:39:01 +02:00
Victor Stinner 2d3222740b Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
on Windows.
2011-04-04 23:05:53 +02:00
Victor Stinner fcb88c4503 Issue #11393: _Py_DumpTraceback() writes the header even if there is no frame 2011-04-01 15:34:01 +02:00
Victor Stinner d727e23243 Issue #11393: The fault handler handles also SIGABRT 2011-04-01 12:13:55 +02:00
Victor Stinner dd810ddb65 Merge 3.2: sys.getfilesystemencoding() raises a RuntimeError if
initfsencoding() was not called yet: detect bootstrap (startup) issues earlier.
2011-03-31 13:40:14 +02:00
Victor Stinner 27181ac778 sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not
called yet: detect bootstrap (startup) issues earlier.
2011-03-31 13:39:03 +02:00
Victor Stinner 024e37adcc Issue #11393: Add the new faulthandler module 2011-03-31 01:31:06 +02:00
Antoine Pitrou d85456279f Issue #11618: Fix the timeout logic in threading.Lock.acquire() under
Windows.
2011-03-31 01:03:10 +02:00
Antoine Pitrou 7899acfc23 Issue #11618: Fix the timeout logic in threading.Lock.acquire() under
Windows.
2011-03-31 01:00:32 +02:00
Éric Araujo be3bd57ba2 Remove traces of division_warning left over from Python 2 (#10998) 2011-03-26 01:55:15 +01:00
Brett Cannon 442c9b92d8 Make importlib compatible with __import__ by "fixing" code.co_filename
paths.

__import__ does a little trick when importing from bytecode by
back-patching the co_filename paths to point to the file location
where the code object was loaded from, *not* where the code object was
originally created. This allows co_filename to point to a valid path.
Problem is that co_filename is immutable from Python, so a private
function -- imp._fix_co_filename() -- had to be introduced in order to
get things working properly. Originally the plan was to add a file
argument to marshal.loads(), but that failed as the algorithm used by
__import__ is not fully recursive as one might expect, so to be fully
backwards-compatible the code used by __import__ needed to be exposed.

This closes issue #6811 by taking a different approach than outlined
in the issue.
2011-03-23 16:14:42 -07:00
Mark Dickinson 7c9e803284 Issue #11244: Remove outdated peepholer check that was preventing the peepholer from folding -0 and -0.0. Thanks Eugene Toder for the patch. 2011-03-23 17:59:37 +00:00
Victor Stinner e9ddbf65a8 Issue #11630, issue #3080: Fix refleak introduced by ef2b6305d395 2011-03-22 10:46:35 +01:00
Victor Stinner 9c61e24be4 Issue #3080: On DJGPP, case_bytes() returns -1 to signal an error if the file
cannot be found.
2011-03-22 01:22:27 +01:00
Victor Stinner 0a5f65ab0a Issue #7330, #10833: Replace %100s by %.100s and %200s by %.200s
I suppose that the author would like to truncate the type name, not get a
string of 100/200 characters.
2011-03-22 01:09:21 +01:00
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