Victor Stinner
b5a7a0aa3f
(Merge 3.3) pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get
...
the size of the env_home buffer, not PATH_MAX+1. env_home is declared using
MAXPATHLEN+1, and PATH_MAX is not declared on IRIX.
2013-11-15 17:12:14 +01:00
Victor Stinner
2f5bbc6a12
pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get the size of
...
the env_home buffer, not PATH_MAX+1. env_home is declared using MAXPATHLEN+1,
and PATH_MAX is not declared on IRIX.
2013-11-15 17:09:24 +01:00
Victor Stinner
3f36a5736b
Issue #19515 : Remove identifiers duplicated in the same file.
...
Patch written by Andrei Dorian Duma.
2013-11-12 21:39:02 +01:00
Victor Stinner
dcf17f8a55
Issue #19466 : Fix typo. Patch written by Vajrasky Kok.
2013-11-12 17:18:51 +01:00
Victor Stinner
45956b9a33
Close #19466 : Clear the frames of daemon threads earlier during the Python
...
shutdown to call objects destructors. So "unclosed file" resource warnings are
now corretly emitted for daemon threads.
2013-11-12 16:37:55 +01:00
Victor Stinner
bd303c165b
Issue #19512 , #19515 : remove shared identifiers, move identifiers where they
...
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner
efa7a0e155
print_error_text() doesn't encode the filename anymore
...
Use aslo PyUnicode_FromFormat() to format the line so only one call to
PyFile_WriteObject() is needed. tb_displayline() of Python/traceback.c has
similar implementation.
2013-11-07 12:37:56 +01:00
Victor Stinner
ad14ccd047
Issue #19512 : add _PyUnicode_CompareWithId() function
...
_PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString()
when both strings are equal and interned.
Add also _PyId_builtins identifier for "builtins" common string.
2013-11-07 00:46:04 +01:00
Victor Stinner
937114f704
print_exception(): don't encode the module name to UTF-8
...
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
2013-11-07 00:12:30 +01:00
Victor Stinner
090543736f
Issue #19512 : add some common identifiers to only create common strings once,
...
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner
95701bdf40
Issue #19512 : Add PyRun_InteractiveOneObject() function
...
Only decode the filename once. PyRun_InteractiveOneObject() uses an identifier
for "<string>" string, so the byte string is only decoded once.
2013-11-06 18:41:07 +01:00
Victor Stinner
4ee41c5839
Issue #19512 : _print_total_refs() now uses an identifier to get "showrefcount"
...
key from sys._xoptions
2013-11-06 18:28:21 +01:00
Christian Heimes
efa48676d5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
...
Python executable and not removed by the linker's optimizer.
2013-10-22 10:23:12 +02:00
Christian Heimes
49e61806f5
Issue #18603 : Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
...
Python executable and not removed by the linker's optimizer.
2013-10-22 10:22:29 +02:00
Nick Coghlan
1805a62f1f
Issue #16129 : Py_SetStandardStreamEncoding cleanups
...
- don't call PyErr_NoMemory with interpreter is not initialised
- note that it's OK to call _PyMem_RawStrDup here
- don't include this in the limited API
- capitalise "IO"
- be explicit that a non-zero return indicates an error
- include versionadded marker in docs
2013-10-18 23:11:47 +10:00
Nick Coghlan
7d270ee05d
Issue #16129 : Add `Py_SetStandardStreamEncoding`
...
This new pre-initialization API allows embedding
applications like Blender to force a particular
encoding and error handler for the standard IO streams.
Also refactors Modules/_testembed.c to let us start
testing multiple embedding scenarios.
(Initial patch by Bastien Montagne)
2013-10-17 22:35:35 +10:00
Antoine Pitrou
6039db8de3
Issue #18776 : atexit callbacks now display their full traceback when they raise an exception.
2013-10-13 21:54:15 +02:00
Antoine Pitrou
24201d497c
Issue #18776 : atexit callbacks now display their full traceback when they raise an exception.
2013-10-13 21:53:13 +02:00
Serhiy Storchaka
bf28d2dcad
Issue #18818 : The "encodingname" part of PYTHONIOENCODING is now optional.
2013-09-13 11:46:24 +03:00
Antoine Pitrou
4879a963d4
Issue #18756 : os.urandom() now uses a lazily-opened persistent file descriptor, so as to avoid using many file descriptors when run in parallel from multiple threads.
2013-08-31 00:26:02 +02:00
Victor Stinner
55a1220bdb
pythonrun.c: use MAXPATHLEN instead of PATH_MAX
...
PATH_MAX is not available on "MIPS IRIX 6.5.30 [SB] 3.x" buildbot
2013-08-28 01:47:46 +02:00
Victor Stinner
daf455554b
Issue #18571 : Implementation of the PEP 446: file descriptors and file handles
...
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Victor Stinner
14e461d5b9
Close #11619 : The parser and the import machinery do not encode Unicode
...
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Antoine Pitrou
7eaf3f7080
Issue #18808 : Non-daemon threads are now automatically joined when a sub-interpreter is shutdown (it would previously dump a fatal error).
2013-08-25 19:48:18 +02:00
Christian Heimes
ad73a9cf97
Issue #16400 : Add command line option for isolated mode.
...
-I
Run Python in isolated mode. This also implies -E and -s. In isolated mode
sys.path contains neither the script’s directory nor the user’s
site-packages directory. All PYTHON* environment variables are ignored,
too. Further restrictions may be imposed to prevent the user from
injecting malicious code.
2013-08-10 16:36:18 +02:00
Antoine Pitrou
32d483c39b
Fix style
2013-07-30 21:01:23 +02:00
Victor Stinner
ba30883f60
Issue #18520 : Fix initstdio(), handle PySys_SetObject() failure
2013-07-22 23:55:19 +02:00
Victor Stinner
62ce62a3a1
Issue #18520 : initsite() is a little bit more verbose when import site fails
2013-07-22 22:53:28 +02:00
Victor Stinner
1c8f059019
Issue #18520 : Add a new PyStructSequence_InitType2() function, same than
...
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).
* PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
* Fix also some calls to PyDict_SetItemString(): handle error
2013-07-22 22:24:54 +02:00
Victor Stinner
d786ad55ef
Issue #18520 : Fix initsigs(), handle PyOS_InitInterrupts() error
...
PyOS_InitInterrupts() can raise error when importing the signal module
2013-07-21 13:25:51 +02:00
Victor Stinner
26f91999b4
Close #18469 : Replace PyDict_GetItemString() with _PyDict_GetItemId() in structseq.c
...
_PyDict_GetItemId() is more efficient: it only builds the Unicode string once.
Identifiers (dictionary keys) are now created at Python initialization, and if
the creation failed, Python does exit with a fatal error.
Before, PyDict_GetItemString() failure was not handled: structseq_new() could
call PyObject_GC_NewVar() with a negative size, and structseq_dealloc() could
also crash.
2013-07-17 01:22:45 +02:00
Victor Stinner
49fc8ece81
Issue #18203 : Add _PyMem_RawStrdup() and _PyMem_Strdup()
...
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
2013-07-07 23:30:24 +02:00
Victor Stinner
51fa458d0a
Issue #18203 : Fix Py_Finalize(): destroy the GIL after the last call to
...
PyMem_Malloc() or PyObject_Malloc().
For example, PyCFunction_Fini() calls PyObject_GC_Del() which calls
PyObject_FREE().
2013-07-07 15:50:49 +02:00
Antoine Pitrou
5f454a07a0
Issue #1545463 : Global variables caught in reference cycles are now garbage-collected at shutdown.
2013-05-06 21:15:57 +02:00
Antoine Pitrou
4adb566ad7
Fix crash caused by 8c1385205a35
...
(thanks Arfrever for reporting).
2013-05-05 08:14:53 +02:00
Antoine Pitrou
fd417cc54b
Fix crash caused by 8c1385205a35
...
(thanks Arfrever for reporting).
2013-05-05 08:12:42 +02:00
Brett Cannon
13853a67cf
#17115 : I hate you MS for not supporting C99.
2013-05-04 17:37:09 -04:00
Antoine Pitrou
df6931dbbc
Issue #17408 : Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again.
2013-05-04 20:46:19 +02:00
Antoine Pitrou
957a23b088
Issue #17408 : Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again.
2013-05-04 20:45:02 +02:00
Brett Cannon
4c14b5de1c
#17115,17116: Have modules initialize the __package__ and __loader__
...
attributes to None.
The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.
This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
2013-05-04 13:56:58 -04:00
Benjamin Peterson
0bb83f812f
merge 3.3 ( #17863 )
2013-04-29 10:23:31 -04:00
Benjamin Peterson
fe1b22af0a
ignore errors when trying to fetch sys.stdin.encoding ( closes #17863 )
2013-04-29 10:23:08 -04:00
Antoine Pitrou
208ac5cf65
Issue #17832 : fix a compilation warning about a function prototype.
...
Also, make the private function static.
2013-04-24 20:17:53 +02:00
Ezio Melotti
1f8898a591
#17323 : The "[X refs, Y blocks]" printed by debug builds has been disabled by default. It can be re-enabled with the `-X showrefcount` option.
2013-03-26 01:59:56 +02:00
Antoine Pitrou
f9d0b1256f
Issue #13390 : New function :func:`sys.getallocatedblocks()` returns the number of memory blocks currently allocated.
...
Also, the ``-R`` option to regrtest uses this function to guard against memory allocation leaks.
2012-12-09 14:28:26 +01:00
Hynek Schlawack
33363f43e3
Issue #15001 : fix segfault on "del sys.module['__main__']"
...
Patch by Victor Stinner.
2012-11-07 09:07:22 +01:00
Hynek Schlawack
5c6b3e214c
Issue #15001 : fix segfault on "del sys.module['__main__']"
...
Patch by Victor Stinner.
2012-11-07 09:02:24 +01:00
Andrew Svetlov
90c0eb28c5
Issue #16218 : Support non ascii characters in python launcher.
...
Patch by Serhiy Storchaka.
2012-11-01 14:51:14 +02:00
Christian Heimes
04ac4c1cb8
Issue #15895 : my analysis was slightly off. The FILE pointer is only leaked when set_main_loader() fails for a pyc file with closeit=0. In the success case run_pyc_file() does its own cleanup of the fp. I've changed the code to use another FILE ptr for pyc files and moved the fclose() to PyRun_SimpleFileExFlags() to make it more obvious what's happening.
2012-09-11 15:47:28 +02:00
Christian Heimes
eeb5635843
Issue #15895 : Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename points to a pyc/pyo file and closeit is false.
2012-09-11 14:11:03 +02:00