Christian Heimes
6a77af690f
Issue #15895 : Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename points to a pyc/pyo file and closeit is false.
13 years ago
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.
13 years ago
Christian Heimes
eeb5635843
Issue #15895 : Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename points to a pyc/pyo file and closeit is false.
13 years ago
Victor Stinner
90ef747e04
Close #13119 : use "\r\n" newline for sys.stdout/err on Windows
sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.
14 years ago
Victor Stinner
7b3f0fa68e
Close #13119 : use "\r\n" newline for sys.stdout/err on Windows
sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.
14 years ago
Victor Stinner
d5698cbbca
Fix initialization of the faulthandler module
faulthandler requires the importlib if "-X faulthandler" option is present on
the command line, so initialize faulthandler after importlib.
Add also an unit test.
14 years ago
Nick Coghlan
b7a5894c64
Refcounting fixes
14 years ago
Nick Coghlan
ceda83c6a9
Make set_main_loader static (noticed by Antoine Pitrou)
14 years ago
Nick Coghlan
3f94cbf9eb
Actually initialize __main__.__loader__ with loader instances, not the corresponding type objects
14 years ago
Nick Coghlan
85e729ec3b
Take the first step in resolving the messy pkgutil vs importlib edge cases by basing pkgutil explicitly on importlib, deprecating its internal import emulation and setting __main__.__loader__ correctly so that runpy still works (Affects #15343 , #15314 , #15357 )
14 years ago
Antoine Pitrou
01cca5e451
Issue #15020 : The program name used to search for Python's path is now "python3" under Unix, not "python".
14 years ago
David Malcolm
49526f48fc
Issue #14785 : Add sys._debugmallocstats() to help debug low-level memory allocation issues
14 years ago
Antoine Pitrou
e67f48ce5e
Issue #14928 : Fix importlib bootstrap issues by using a custom executable (Modules/_freeze_importlib) to build Python/importlib.h.
14 years ago
Benjamin Peterson
d5a1c44455
PEP 415: Implement suppression of __context__ display with an exception attribute
This replaces the original PEP 409 implementation. See #14133 .
14 years ago
Brett Cannon
62228dbd6c
Issues #13959 , 14647: Re-implement imp.reload() in Lib/imp.py.
Thanks to Eric Snow for the patch.
14 years ago
Brett Cannon
e0d88a173c
Issue #14605 : Make explicit the entries on sys.path_hooks that used to
be implicit.
Added a warning for when sys.path_hooks is found to be empty. Also
changed the meaning of None in sys.path_importer_cache to represent
trying sys.path_hooks again (an interpretation of previous semantics).
Also added a warning for when None was found.
The long-term goal is for None in sys.path_importer_cache to represent
the same as imp.NullImporter: no finder found for that sys.path entry.
14 years ago
Brett Cannon
6f44d66bc4
Issue #13959 : Rename imp to _imp and add Lib/imp.py and begin
rewriting functionality in pure Python.
To start, imp.new_module() has been rewritten in pure Python, put into
importlib (privately) and then publicly exposed in imp.
14 years ago
Brett Cannon
fc9ca274b8
Plug a refleak.
14 years ago
Brett Cannon
fd0741555b
Issue #2377 : Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
14 years ago
Benjamin Peterson
80d50428ce
fix parse_syntax_error to clean up its resources
14 years ago
Benjamin Peterson
b9348e76e4
fix parse_syntax_error to clean up its resources
14 years ago
Nick Coghlan
ab7bf2143e
Close issue #6210 : Implement PEP 409
14 years ago
Antoine Pitrou
776af4002b
Fix crash at startup with -W options.
14 years ago
Antoine Pitrou
cc3fa88a9c
Fix crash at startup with -W options.
14 years ago
Antoine Pitrou
86838b02f0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
14 years ago
Barry Warsaw
1e13eb084f
- Issue #13703 : oCERT-2011-003: add -R command-line option and PYTHONHASHSEED
environment variable, to provide an opt-in way to protect against denial of
service attacks due to hash collisions within the dict and set types. Patch
by David Malcolm, based on work by Victor Stinner.
14 years ago
Georg Brandl
2daf6ae249
Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
14 years ago
Meador Inge
fa21bf015d
Issue #12705 : Raise SyntaxError when compiling multiple statements as single interactive statement
14 years ago
Antoine Pitrou
2fabface50
Fix a memory leak when initializing the standard I/O streams.
14 years ago
Antoine Pitrou
5136ac0ca2
Issue #13645 : pyc files now contain the size of the corresponding source
code, to avoid timestamp collisions (especially on filesystems with a low
timestamp resolution) when checking for freshness of the bytecode.
14 years ago
Florent Xicluna
aa6c1d240f
Issue #13575 : there is only one class type.
14 years ago
Antoine Pitrou
11942a58a1
Issue #7111 : Python can now be run without a stdin, stdout or stderr stream.
It was already the case with Python 2. However, the corresponding
sys module entries are now set to None (instead of an unusable file object).
14 years ago
Antoine Pitrou
d7c8fbf89e
Issue #13444 : When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
This also adds a test for issue #5319 , whose resolution introduced the issue.
14 years ago
Victor Stinner
e251d6d69d
print_exception() uses PyUnicode_GetLength() instead of PyUnicode_GetSize()
14 years ago
Antoine Pitrou
f34a0cdc6c
Issue #10227 : Add an allocation cache for a single slice object.
Patch by Stefan Behnel.
14 years ago
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.
14 years ago
Martin v. Löwis
1c67dd9b15
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
14 years ago
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
14 years ago
Martin v. Löwis
1ee1b6fe0d
Use identifier API for PyObject_GetAttrString.
14 years ago
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.
14 years ago
Barry Warsaw
916048d780
- Issue #13021 : Missing decref on an error path. Thanks to Suman Saha for
finding the bug and providing a patch.
14 years ago
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.
15 years ago
Victor Stinner
13b21bd749
print_exception(): handle correctly PyObject_GetAttrString() failure
Bug found by the Clang Static Analyzer.
15 years ago
Georg Brandl
11041f0af9
Port #6498 fix: fix several misspellings of "SystemExit" as "SystemError".
15 years ago
Georg Brandl
0b2489e986
Closes #6498 : fix several misspellings of "SystemExit" as "SystemError".
15 years ago
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.
15 years ago
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.
15 years ago
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.
15 years ago
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.
15 years ago
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.
15 years ago