summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593)Eric Snow2017-09-151-8/+3
| | | | | The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls. We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.
* bpo-28411: Isolate PyInterpreterState.modules (#3575)Eric Snow2017-09-141-28/+32
| | | | | A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason. Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts.
* bpo-30860: Fix a refleak. (#3567)Eric Snow2017-09-141-1/+9
| | | | | Resolves bpo-31420. (This was accidentally reverted when in #3565.)
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-41/+35
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-30860: Fix a refleak. (#3506)Eric Snow2017-09-121-1/+9
| | | | | | | | | | | | | | * Drop warnoptions from PyInterpreterState. * Drop xoptions from PyInterpreterState. * Don't set warnoptions and _xoptions again. * Decref after adding to sys.__dict__. * Drop an unused macro. * Check sys.xoptions *before* we delete it.
* delete dead locale initialization code for windows (#3461)Benjamin Peterson2017-09-081-5/+1
|
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-31/+64
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-12/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-061-57/+31
| | | Windows buildbots started failing due to include-related errors.
* correct initialization code (#3376)Benjamin Peterson2017-09-061-1/+1
| | | Explicitly initialize struct members rather than relying on compiler extensions.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-31/+57
| | | | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-041-34/+32
| | | sys.modules is the one true source.
* Fix a small typo in a comment (#2863)Stéphane Wirtel2017-07-251-1/+1
|
* bpo-30647: Check nl_langinfo(CODESET) in locale coercion (GH-2374)Nick Coghlan2017-06-291-8/+11
| | | | | | | | | | | | | - On some versions of FreeBSD, setting the "UTF-8" locale succeeds, but a subsequent "nl_langinfo(CODESET)" fails - adding a check for this in the coercion logic means that coercion will happen on systems where this check succeeds, and will be skipped otherwise - that way CPython should automatically adapt to changes in platform behaviour, rather than needing a new release to enable coercion at build time - this also allows UTF-8 to be re-enabled as a coercion target, restoring the locale coercion behaviour on Mac OS X
* bpo-30565: Add PYTHONCOERCECLOCALE=warn runtime flag (GH-2260)Nick Coghlan2017-06-181-25/+40
| | | | | | | | | | | | - removes PY_WARN_ON_C_LOCALE build time flag - locale coercion and compatibility warnings are now always compiled in, but are off by default - adds PYTHONCOERCECLOCALE=warn runtime option to aid in debugging potentially locale related compatibility problems Due to not-yet-resolved test failures on *BSD systems (including Mac OS X), this also temporarily disables UTF-8 as a locale coercion target, and skips testing the interpreter's behavior in the POSIX locale.
* bpo-28180: Implementation for PEP 538 (#659)Nick Coghlan2017-06-111-7/+167
| | | | | | | | | | - new PYTHONCOERCECLOCALE config setting - coerces legacy C locale to C.UTF-8, C.utf8 or UTF-8 by default - always uses C.UTF-8 on Android - uses `surrogateescape` on stdin and stdout in the coercion target locales - configure option to disable locale coercion at build time - configure option to disable C locale warning at build time
* bpo-30547: Fix multiple reference leaks (#1995)Stéphane Wirtel2017-06-081-1/+4
| | | | | | | | Fix regressions introduced by: - bpo-22257: commits 1abcf6700b4da6207fe859de40c6c1bada6b4fec and 6b4be195cd8868b76eb6fbe166acc39beee8ce36 Co-Authored-By: Victor Stinner <victor.stinner@gmail.com> Co-Authored-By: Louie Lu <git@louie.lu>
* Drop a duplicate line. (#1809)Eric Snow2017-05-251-2/+1
|
* bpo-22257: Private C-API for main interpreter initialization (PEP 432). (#1729)Eric Snow2017-05-241-13/+67
| | | (patch by Nick Coghlan)
* bpo-22257: Private C-API for core runtime initialization (PEP 432). (#1772)Eric Snow2017-05-241-42/+180
| | | (patch by Nick Coghlan)
* Improves test_underpth_nosite_file to reveal why it fails. (#1763)Steve Dower2017-05-231-1/+6
| | | | | | | | | | | | | | * Improves test_underpth_nosite_file to reveal why it fails. * Enable building with Windows 10 SDK. * Fix WinSDK detection * Fix initialization on Windows when a ._pth file exists. * Fix tabs * Adds comment about Py_GetPath call.
* bpo-22257: Small changes for PEP 432. (#1728)Eric Snow2017-05-231-5/+10
| | | PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
* bpo-29102: Add a unique ID to PyInterpreterState. (#1639)Eric Snow2017-05-231-0/+1
|
* bpo-30225: Fix is_valid_fd() on macOS Tiger (#1443)Victor Stinner2017-05-031-0/+9
| | | | | is_valid_fd() now uses fstat() instead of dup() on macOS to return 0 on a pipe when the other side of the pipe is closed. fstat() fails with EBADF in that case, whereas dup() succeed.
* bpo-29770: remove outdated PYO related info (GH-590)Xiang Zhang2017-03-111-1/+1
|
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-3/+3
| | | | UTF-8 represenatation of Unicode objects.
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-2/+2
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #26920: Fix not getting the locale's charset upon initializing the ↵Xavier de Gaye2016-11-161-1/+1
| | | | | | interpreter, on platforms that do not have langinfo
* Don't run garbage collection on interpreter exit if it was explicitly disabledŁukasz Langa2016-09-101-3/+3
| | | | by the user.
* Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-0/+1
|
* Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.Yury Selivanov2016-09-091-1/+7
| | | | Patch by Ivan Levkivskyi.
* Issue #1602: Windows console doesn't input or print Unicode (PEP 528)Steve Dower2016-08-311-0/+18
| | | | Closes #17602: Adds a readline implementation for the Windows console
* Issue #23524: Finish removing _PyVerify_fd from sourcesSteve Dower2016-09-081-1/+1
|
* Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529)Steve Dower2016-09-081-0/+20
|
* Avoid calling functions with an empty string as format stringVictor Stinner2016-09-061-5/+5
| | | | Directly pass NULL rather than an empty string.
* Issue #27574: Decreased an overhead of parsing keyword arguments in functionsSerhiy Storchaka2016-08-141-0/+1
| | | | implemented with using Argument Clinic.
* Issue #22557: Now importing already imported modules is up to 2.5 times faster.Serhiy Storchaka2016-08-021-0/+5
|
* Issue #23034: The output of a special Python build with defined COUNT_ALLOCS,Serhiy Storchaka2016-07-031-1/+1
| | | | | | SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can be re-enabled using the "-X showalloccount" option. It now outputs to stderr instead of stdout.
* Issue #27336: Fix compilation on WindowsVictor Stinner2016-06-171-2/+2
| | | | Replace "#if WITH_THREAD" with "#ifdef WITH_THREAD".
* Issue #27336: Fix compilation failures --without-threadsBerker Peksag2016-06-171-0/+2
|
* Issue #22747: Workaround for systems without langinfo.h.Stefan Krah2016-04-251-0/+2
|
* Issue #25339: PYTHONIOENCODING now has priority over locale in setting theSerhiy Storchaka2016-04-101-10/+9
|\ | | | | | | error handler for stdin and stdout.
| * Issue #25339: PYTHONIOENCODING now has priority over locale in setting theSerhiy Storchaka2016-04-101-10/+9
| | | | | | | | error handler for stdin and stdout.
| * Py_FatalError: disable faulthandler earlierVictor Stinner2016-03-161-5/+5
| | | | | | | | | | Issue #26563: Py_FatalError: disable faulthandler before trying to flush sys.stdout and sys.stderr.
| * Fix Py_FatalError() if called without the GILVictor Stinner2016-03-141-34/+50
| | | | | | | | | | | | Issue #26558: If Py_FatalError() is called without the GIL, don't try to print the current exception, nor try to flush stdout and stderr: only dump the traceback of Python threads.
* | Py_FatalError: disable faulthandler earlierVictor Stinner2016-03-161-5/+5
| | | | | | | | | | Issue #26563: Py_FatalError: disable faulthandler before trying to flush sys.stdout and sys.stderr.
* | faulthandler now works in non-Python threadsVictor Stinner2016-03-161-15/+1
| | | | | | | | | | | | | | | | | | | | | | Issue #26563: * Add _PyGILState_GetInterpreterStateUnsafe() function: the single PyInterpreterState used by this process' GILState implementation. * Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from autoInterpreterState in last resort. The function now accepts NULL for interp and current_tstate parameters. * test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
* | Add more checks on the GILVictor Stinner2016-03-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Issue #10915, #15751, #26558: * PyGILState_Check() now returns 1 (success) before the creation of the GIL and after the destruction of the GIL. It allows to use the function early in Python initialization and late in Python finalization. * Add a flag to disable PyGILState_Check(). Disable PyGILState_Check() when Py_NewInterpreter() is called * Add assert(PyGILState_Check()) to: _Py_dup(), _Py_fstat(), _Py_read() and _Py_write()
* | Fix Py_FatalError() if called without the GILVictor Stinner2016-03-141-34/+50
| | | | | | | | | | | | Issue #26558: If Py_FatalError() is called without the GIL, don't try to print the current exception, nor try to flush stdout and stderr: only dump the traceback of Python threads.
* | Add PYTHONMALLOC env varVictor Stinner2016-03-141-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Issue #26516: * Add PYTHONMALLOC environment variable to set the Python memory allocators and/or install debug hooks. * PyMem_SetupDebugHooks() can now also be used on Python compiled in release mode. * The PYTHONMALLOCSTATS environment variable can now also be used on Python compiled in release mode. It now has no effect if set to an empty string. * In debug mode, debug hooks are now also installed on Python memory allocators when Python is configured without pymalloc.